unity3d - Dependency sprite animation from the variable -


there sprite sheet animation. how make depend on variable (float)? is, if variable # 1 half size of variable # 2, animation half , on. sprites of progress bar type. tried method:

"rewind clip desired frame, since can rewind in time, calculate how long 1 frame lasts, dividing second fps value of animation.for example, have clip of 30 frames per second, 1/30 =" 1 frame time "if need rewind fifth frame, rewind clip time 5 *"time of 1 frame".

and problem:

public animationclip heatup; public animation anim; //start time = 0.0166f; //update time2 = machinegun.cooldown * time; int myint = convert.toint32(time2); gameobject.find("machinegun").getcomponent<animation>().play(); anim["heatup"].speed = 0;  //cs:44 anim["heatup"].time = time2; 

raises error - nullreferenceexception: object reference not set instance of object uicontroller.update () (at assets / scripts / uicontroller.cs: 44), although there no errors in vs , pointed in inspector.

thanks.


Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -