0
Answered

Tutorial - not getting past the second step

blackmanatee 3 years ago updated by Lazlo Bonin (Lead Developer) 3 years ago 3

Working in Unity 5.6, using the latest Chronos (2.4.9), in a totally new project with no other assets besides Playmaker and the required 2D Platformer game required for the tutorial...

Under the tutorial heading "Modifying the enemy script" are instructions to change the file "enemy.cs" to replace the previous movement function with the following:

// Use Timeline instead of Rigidbody2D

time.rigidbody2D.velocity = new Vector2
(
    transform.localScale.x * moveSpeed,
    time.rigidbody2D.velocity.y
);

I've followed the previous instructions to the letter, including adding the timeline to the enemy prefabs (plus the other Editor-based steps), created/saved the BaseBehaviour and TimeControl scripts, and attached TimeControl to the scene's Timekeeper.

As written above, the code isn't usable (no definition for "time"). I've tried switching to "this.GetComponent<time.rigidbody2D>.velocity, or substituting Timeline for "time," but no dice.

I must be missing something totally obvious, because I don't see that anyone has brought up this issue before. Please let me know why your tutorial code doesn't seem to be functioning.

Chronos Version:
2.4.9
Unity Version:
5.6

Answer

Answer
Answered

Hi!

Sorry, there's a little order problem in the tutorial.

Right after this part, it says:

That's it! Notice that we used our time shortcut, so we need to change the base class of the script (and of course, add Chronos as a using):
using UnityEngine;
using System.Collections;
using Chronos; 
public class Enemy : BaseBehaviour // ...

If you change MonoBehaviour to BaseBehaviour, the time symbol should become defined.

Let me know if this fixes your issue!

GOOD, I'M SATISFIED
Satisfaction mark by blackmanatee 3 years ago
Answer
Answered

Hi!

Sorry, there's a little order problem in the tutorial.

Right after this part, it says:

That's it! Notice that we used our time shortcut, so we need to change the base class of the script (and of course, add Chronos as a using):
using UnityEngine;
using System.Collections;
using Chronos; 
public class Enemy : BaseBehaviour // ...

If you change MonoBehaviour to BaseBehaviour, the time symbol should become defined.

Let me know if this fixes your issue!

Thanks, Lazlo! That fixed the problem nicely. And you're right -- when I tried to solve the problem, I had assumed that I had done something wrong -- so I meticulously re-did all the prior steps. I had never thought to look forward for a solution, because the tutorial implies that the game runs at that point in the script revision. Since mine wasn't able to run at all, I assumed I was doing something wrong. I had the "using" in there, but I've never done a modification to the monobehavior in that way before, so it was new ground for me.

That's probably the biggest problem with being self-taught, learning C# as I go: after doing this a couple of years, there are still substantial gaps in my basic knowledge (like with classes/behaviors/inheritance/etc.).

For future learn-as-you-go-ers like me, I hope you'll edit the tutorial so that you instruct readers to switch to BaseBehaviour before they need to refer to time in the script. It may save a headache or two! ;-)

Thanks again--

I edited the tutorial to reflect the correct order. Thanks for the feedback, and good luck with your project!

Lazlo