Is anyone else having this issue and figured out how to solve it. I have followed all instructions to a T. My Robot character moves back and forth but only faces right even though I used the Animator and successfully added the blends for all directions. I tried to look at the code in the demo game but it is entirely different than that given in the tutorial. For some reason, the instructor decided not to show all the code in context and assumed that we noobs would know exactly where to put the code after only getting through half the tutorial. I have been solving most of the issues but this one really has me stumped.
Script is attached as a comment
I had the same issue as you. I went into the EnemyController script and found there were lower case “X” and “Y” in the code that needed to be capitalize.
animator.SetFloat("Move X", direction);
animator.SetFloat("Move Y", 0);
You’ll find them in the “if” and “else” statements. Other than that everything I did was according to the tutorial.
Thank you for responding. My Xs and Ys are capitalized . The Robot is walking back and forth but is not turning when he reaches the end of the screen as it shows in the tutorial lesson.
I noticed that the tutorial does not seem to add any code to modify the vertical variable, so if you want to, you’ll probably want to set up a second set of timers which you can then update and check like so:
public float upDownChangeInterval = 3.0f;
float upDownTimer;
…
upDownTimer -= Time.deltaTime;
if (upDownTimer < 0)
{
vertical = !vertical;
upDownTimer = upDownChangeInterval;
}
This won’t have the robot turn at the edges of the screen. To do that, you might need some kind of collision object / area along the edge of the screen that the robot reacted to. But that isn’t really covered in the tutorial either.