c# - How to animate property-changes properly -


i'm developing game using unity.

here's example of how animate property-changes (like alpha-value of color/position/counting numbers).

is there better way handle such changes on time?

edit: i'd able trigger event or execute code once animation finished

public class myobject : monobehaviour{  //enum indicating state of object public enum state {     ready,     disappearing }  private state objstate = state.ready;  update (){     if (objstate == state.disappearing){         color oldcolor = this.gameobject.getcomponent<text>().color;         oldcolor.a -= time.deltatime; //disappearing takes 1 second          if (oldcolor.a <= 0.0f){             oldcolor.a = 0;             objstate = state.ready;         }         this.gameobject.getcomponent<text>().color = oldcolor;     } } } 


Comments

Popular posts from this blog

shopping cart - Page redirect not working PHP -

php - How to modify a menu to show sub-menus -

python - Installing PyDev in eclipse is failed -