Search Unity

why aren't my spikes falling down?

Discussion in '2D' started by brunoenvia, Aug 17, 2019.

  1. brunoenvia

    brunoenvia

    Joined:
    Aug 5, 2019
    Posts:
    18
  2. Gambit-MSplitz

    Gambit-MSplitz

    Joined:
    May 16, 2015
    Posts:
    1,195
    When you control a variable with an animator, you cannot control it with code at the same time because the animator will immediately overwrite your change. In this case, you can't change your transform.position because you are controlling transform.position with the animator.

    To solve this, you can either turn off your animator before you tell your spikes to fall, or you can have your animator on a parent object, animate the child object, and apply the falling logic to the parent object.
     
  3. Ledesma099

    Ledesma099

    Joined:
    May 15, 2018
    Posts:
    6