Search Unity

Changing Base Sprite on a GameObject which has Sprite Switching animations

Discussion in '2D' started by wecook2D, Nov 25, 2015.

  1. wecook2D

    wecook2D

    Joined:
    Feb 19, 2015
    Posts:
    10
    Hey there,

    Here what I want to do ( as shown on the picture ) :

    I have a game object ( MONSTER ) , Composed with multiple sprites, ( BODY & MOUTH) which has an IDLE animation and an ATTACK animation.
    the IDLE animation only contain position/rotation/scale anim.
    the ATTACK animation has in addition a sprite switching animation.

    it works well up to this point.

    Now I want to change the base Sprites of the MONSTER at runtime, depending on how it is wounded.
    the sprites BODY_02 & MOUTH_02 are the wounded versions.

    Now I have a problem :

    I've tried Layers, BlendTree, SubState, changing sprite in code at runtime...
    The BODY sprite - which is not updated in any animation - is changing well, but the MOUTH sprite is always rewrote by - I think - Mecanim, even if I never start the ATTACK animation.

    Has anyone tried something like that before?
    I have some kind of workaround which consists of separating animated sprites and "static" sprites then hide/reveal them in animation instead of switching the sprite.. but I can't do transitions like that.


    animSprite.jpg