in my game, the character can only walk forward in a strait line and cant walk backwards.
I want to check when the player has walked an amount of units.
then I want to play an animation.
I tried something like:
if (gameobject.transform.position.y = XX)
{
animation.play;
}
then it tells me:
error CS0236: A field initializer cannot reference the nonstatic field, method, or property `UnityEngine.Component.gameObject’
what can I do instead???