How to make an animation clip on Unity to loop - unity3d

I am using the Unity Mecanim, and I have two animation clips:
The problem is that when the animation of a clip finish it doesnt start again from the beggining, it doesnt loop, and I cannot find any option to make it loop.
Any help, where to look for the loop options?
EDIT:
I find the options according to the answers here but there are not editable, is it because I download this from Asset Store?

Its probably too late to help you with this, but just incase anyone else has this issue, your looping options are greyed out because your animation from the asset store is read-only, select your animation in the project window, and press Ctrl+D to duplicate it, and you should be able to now set the looping options on the new animation as the other answerers have described.

Click on your Run_Impulse animation file and there is an option:
http://docs.unity3d.com/Documentation/Components/class-AnimationClip.html
Loop Pose option should be cheked for make it loop
Here, there is more information about making loop an animation clip:
http://docs.unity3d.com/Documentation/Manual/LoopingAnimationClips.html
EDIT: I add an image. You have to select your imported FBX (not the animation file inside) and check the Loop Time.

http://answers.unity3d.com/questions/204331/animation-loop.html
Go to the animation and set it as looping .In the Animation window look at the bottom for something that should say 'Default' - it's a drop-down menu with looping options (Loop starts the animation over, PingPong plays it back and forth, Clamp Forever freezes the animation at the state of the last frame etc.)

Related

Unity animation transition glitches back to last animation

So, I have my animation and it goes to an empty state.
The thought behind this is that it goes to it's default no animation state.
However, before it does that, it glitches back in to the old animation.
I tested it, it only happens whenever I go from an animation to an empty state.
It always glitches for the same amount of time for each transition, however it is different for each transition.
I have never seen something like this before, does anyone of you know the problem?
The animation
The clear state
The transition
What do you mean by glitching? I am going to take a guess and say you do not want an exit timer, so uncheck this box.
An exit timer is just used to transition between two states and will take the amount of time to wait to transition. In your transition block, it also shows you stacking your two animations which might be why everything looks weird for a short time. Instead of an exit timer, you might want to use parameters to change your states or directly set them in code.
The other possible issue is the checkbox Write Defaults.
From the Unity Docs, the description of Write Defaults is
Whether or not the AnimatorStates writes back the default values for
properties that are not animated by its Motion.
Unexpected behavior with animators can be caused by Write Defaults if you are not familiar with how they work or what they do. Again, it is hard to say what exactly is wrong with the description of your issue. Try unchecking each of these boxes individually and seeing if either one fixes your issue. If that does not work, try both and if that does not work, let me know what your issue is in more detail. Possibly attach a gif or video showing what is breaking as the written description is not helping too much.

Image animation problems in Unity

I state that I am not very experienced in Unity.
I am working on a project in which I have some pictures. To these images I have added an animation that modifies the viewing scale (x,y,z), in such a way as to obtain a pulsation effect. ("ImageEffectPingPong")
To these same images, however, I added another animation that when the image is clicked, a fade effect is obtained, in such a way as to make the image disappear.("fadeOut_x")
When I go to make transition one of the two animations to the animator, it works as it should. the problem is when I try to merge them.
The ImageEffectPingPong animation is set in loop, while the other is activated by setting a bool to the onclick event.
animator.SetBool($"img_{pos}",true);
This is my animator
I tried a combination like this, but when I hit the first image, the fade works, but I no longer get the "pingpong" effect I want.
So how do i get the pingpong effect and when i click on an image, the fade effect, without losing the pingpong effect on the other images?
PS: to create the first effect I created a single animation that changes the scale of each image at the same time, while for the fade effect, each image has its own animation. Images can disappear following the correct sequence.
Sorry for my bad English, I hope I have explained myself as well as possible, I remain available for any misunderstandings. thank you
in case anyone has the same problem as me, I was able to solve it by adding a layer. In the first layer I run the fade animation, while in the second the pingpong effect. It is important to set the weight of the layer.

How can I swap out a unity animation for another while keeping the same duration into the animation?

I've seen this question asked here but it was never answered, and mines a bit different.
As an example: lets say I'm making a character that's constantly on a looping animation, and I have a button that you can hold down to make the character wear sunglasses, the sunglasses are kept on a separate animation of the same framerate and frame count. How can I use the button to switch them but start the new animation on the same frame as the last?
Edit: I've found a function for animators called PlayInFixedTime() this is the documentation for it, I don't know what it does but it mentions a "time offset" so it could be what I'm looking for, but I have no clue.
In my opinion you can solve this in 2 ways:
Animation Events: via script you are able to select the end of an animation even if it is looping
Wrap mode: there is an example here (https://answers.unity.com/questions/37080/stopping-an-animation-from-looping-at-the-end.html) but basically you are able to play an animation in Queue after the end of the previous. You can do it with a simple function so you are able to reuse it many times

How can I change animation clip length?

The problem is that it's very short. The animation is walking. But the animation length is very short and I want to extend the walking.
When I select the walking animation I see it's read only:
After selecting it I can change the time but the clip it self will be still short:
Copy all keyframes, make a new animation clip, drag it out in time...
HOW TO:
You can select every single keyframe by dragging a marquee selection around all those keyframes and copying them.
Then create a new Animation Clip with the "Create New Clip..." choice in that dropdown where it's showing your current clip to be read only.
In the new clip, make sure the timeline is at 0, and past all your keyframes.
Now select all those keyframes again, with the marquee selection again, and grab the handle at the end, it should be a dark blue vertical stripe going from the top of the time line to the bottom. And drag this to the right, as far as you need. This should do an equal time scaling for all keyframes.
To make an animation within an imported model editable, select the model, expand the inner assets, select the animation, then press Ctrl+D (probably Cmd+D on mac?) to duplicate the animation clip. Unity will create a separate copy of it in your assets, which will then be editable.
However, for this specific case, I'd recommend looping the animations (you want the character to reach the door, She simply doesn't go that far in the animation). Otherwise, if you really just want to make the clip "longer", you can adjust the playback speed within Animator. After you add in a clip, select its node and you'll see an adjustable speed in the inspector.

Avatar removed from Pivot point

I was animating an avatar, and was trying various things out, and all of a sudden she was transformed from her pivot point. She also lost the T-pose. I couldn't figure out how to get her back to the original state, removing the animation didn't help. I am going to deleting that avatar and start over, but first I want to learn from this.
I am really looking for a few things here:
how could that happen? It looks like somehow the state at some point of the animation became the new "ground" state or something.
is there anyway I could inspect this state, edit it, or failing that, reset it?
is there something I should read somewhere to understand this better? I found nothing
Screen shot of displaced avatar:
The top level inspector in the heirarchy:
Here is one with the animator controller:
Update:
The key was the suggestion by Fiffe that you need to make sure your flow gets to your exit state. In my case I was neglecting to do that.
There's few things that might be causing this. You probably wanna play around with animation clip settings - you can find them by selecting animation clip.
You can read more about it here https://docs.unity3d.com/Manual/class-AnimationClip.html
You probably want to turn off Apply Root Motion in your Animator too.
If that doesn't help you should check if you don't have any empty states (without animations) in your animator controller.