Search Unity

Prefabs have synchronised animation, how do I randomise this?

Discussion in 'Prefabs' started by Deleted User, Dec 29, 2019.

  1. Deleted User

    Deleted User

    Guest

    [SELF SOLVED!]

    So, I'm working on a Breakout clone where I use a loop function to create different shapes of block sets for a set of given parameters, this way the levels can be somewhat randomly generated.

    I'm happy with all of the above, but I wanted to add an animated face to each block in order to communicate some information to the player... it's how the gameplay works without going on about it too much about it.

    Anyway, I have the animation working fine, but each block animates in perfect sync.

    I attempted to add an animator class to the BlockPlacement script so that I could randomise the transition parameter in the Animator, and I dropped the Animation Control into the BlockPlacement inspector to reference it, but this has no effect and the the animation just defaults to the Transition parameter I set.

    I'm probably going about this all the wrong way, any ideas?

    I fixed it. I just need to place the script on the prefab, not the BlockPlacement code.
     
    Last edited by a moderator: Dec 29, 2019