Search Unity

Reusing Animation Events for different functions

Discussion in 'Animation' started by militarybeetle, Aug 13, 2022.

  1. militarybeetle

    militarybeetle

    Joined:
    Mar 27, 2019
    Posts:
    10
    Hey folks, I'm using animation events in Mechanim to trigger code. But is there a way to reuse the animation/event but change the function it calls?

    For example I might have Red Wizard and Blue Wizard with the CastSpell animation, and both have a CastAssignedSpell function called via an animation event

    However if the animation played for one Wizard game object and the event happened, BOTH CastAssignedSpell functions get called.

    Is there a way around this without having to make copies of the animation for each pallete swap enemy?