- Home /
 
 
               Question by 
               Harald Scheirich · Jun 13, 2011 at 01:24 PM · 
                animationcurvespritemanager2  
              
 
              How to add color animations to spritemanager2 sprites
I am trying to add an color animation (alpha) to a spritemanager 2 packed sprite via unity animations. While there is the color attribute in the editor, this is not used during runtime (it is excluded). Right now I added a separate behavior that calls SetColor() on the sprite.
Is there a more elegant solution that lets me edit the curves in the animation editor, and have a preview and works during runtime ?
               Comment
              
 
               
              Answer by freewill · Aug 19, 2011 at 03:57 AM
I don't know but it's add the your GameObject with Sprite Script.
 using UnityEngine;
 
 class FW_SM2ColorAni : MonoBehaviour
 {
     Sprite m_Sprite;
 
     // Use this for initialization
     void Start ()
     {
         m_Sprite = gameObject.GetComponent<Sprite>();
     }
 
     void Update()
     {
         m_Sprite.SetColor(new Color(m_Sprite.color.r, m_Sprite.color.g, m_Sprite.color.b, m_Sprite.color.a));
     }
 }
 
              Your answer