c# - How can I go to specific frame in animation? -


In my game I have created a world view to let the player see progress from one level to another It is that I have shortened "steppingstone", three between each level so if I have three levels, then there are six small points between them.

Everything that I have done has been made a phantom where there is 1 dot in frame 1, 2 points in frame 2 are something like this:

  0 - - - 0 - - - 0   

Where the player has defeated 1 level, it will look like this:

  0 - - - 0  < / pre> 

So I've cut my phantom, and added an animation. By default it plays again and again, I set this speed to 0.

Gameback has been named "Leleadotts", this controller is an animator with "leveldots_0" I think the name of the animation is "Layleadots" because it has the property with the play icon? I am new to this ...

Therefore, in my updates (in all places) in my camera I want to control the dots frame. For example, I know that the player has defeated 1 level, so I want to show the dots at 2 levels.

I thought I could capture the animator and I would be happy:

  Animate level dots = game object.fund ("leleadots"). GetComponent & lt; Animator & gt; ();   

And when I try the next logic (???) and capture the animation, it becomes boring:

  leveldots .animation ["leveldots"]. Time = 1.0f;   

And where I get the error:

  "leveldots_0" There is no 'animation' associated with the game object, but a script is trying to do it   

How can I get an animation, and go to frame / timeline in animation?

This error is saying that your animation components are not attached to your game object. You are using an animator component. An animator component is like a state machine in which you can add animations to some parameters, and you can also interpolate between animations.

Now, leveldots.animation is a reference to the animation componenet of that object, not animator, you can just change a componenet for another, and use the same animation , You can reach that trough. Or you can learn how to use an animator!

Comments

Popular posts from this blog

Verilog Error: output or inout port "Q" must be connected to a structural net expression -

jasper reports - How to center align barcode using jasperreports and barcode4j -

c# - ASP.NET MVC - Attaching an entity of type 'MODELNAME' failed because another entity of the same type already has the same primary key value -