How to use Unity Legacy Animation System to play sequence frame animation? - unity3d

I have already made a sequence frame animation in Unity with Mecanim system. But I do not want to setup Mecanim's animator component and animator controller. I think Legacy Animation System is much lighter and easier for my project.
I first added Animation and Sprite Renderer component to an object.
And then using Animation window to create a property of Sprite Renderer's sprite.
Finally, added every sprite to key frame and make sequence as usual.
But After the settings, I found the sprite renderer or image component can not work. The animation component could not drive the SpriteRenderer.sprite or Image.sprite.
So is it must be achieved by script?

Related

How to prefab animations in Unity?

created a prefab for door and added the prefab doors to the scene. This prefab door has an animator. The problem is when I try to change the animator x,y,z position on the second door in the scene it changes the first door.
I tried duplicating the doors and changing the position x y z but it changed the animator for the first door.
I just have a script that play the animator.
The expected result should be that I can drag and drop doors as needed without creating individual animators for each door. It looks like i need to create animators per door there is and also this probably will require me to create new scripts per each door. It seems awkward since I should be able to add doors and just chaning the position x y z in the animator.
The problem is that their Animator component uses the same AnimatorController asset which uses certain AnimationClip asset references for it's states.
I don't know if there is an easier way for achieve but I would do the following:
For what you want you would have to copy the AnimatorController asset (CTRL+D) as well as the AnimationClip asset you want to change.
Then in the cloned AnimatorController click on the according State you want to change and in the Inspector reference the according cloned AnimationClip.
Now you have a copy of the AnimatorController using a different AnimationClip but with the same states, traditions etc. so you can edit both animations and controllers individually.
finally in the Animator component reference the according AnimatorController for each prefab.
The remaining problem maybe is now that for the future if you change the States, transitions and especially parameters you have to do it in both AnimatorController assets individually.
That is perhaps not because of an animator, but a specific behavior of animation in Unity. Animation animates transform property according to parent, as far as I understand. So the first parent of your prefab is captured, and its transform property is used for animation. But I'm not exactly sure about this explanation - the actual behavior is covered under the Unity's source code. A common solution for this that I found is to create a parent or container inside your object's prefab. I don't know why it works, but it works. Perhaps because the parent of your animated object is now always the same.
Parent can be just an empty game object. So you make your door prefab, place another empty game object into this prefab, make your door a child of this container, set 0 for all coordinates of your door according to container and for the container itself. Now you can add an animator component to your object, which you want to animate (not the container), and animate it inside the prefab scene. After that you can place the copies of this prefab (container + your animated object inside) wherever you want inside your game scene - all animations of copies will proceed independently.

best way to change 2d sprite to animation

I have a GameObject for Chest(with Collider and SpriteRenderer)
By default it is a static sprite on the screen
now i want to add animation to this game object when open is triggered (by script), I do not have Idle animation, idle animation must be the sprite itself
what is the best to add an animation(no looping, 1 time and then show the animated sprite) to sprite?
I can do it by adding the sprite array and using an coroutine to set the sprite periodically with 0.2f delay (it work fine but not sure if it is the only way which using coroutine with delays to simulate an animation by myself...).
I can do it by create 1 more GameObject with the Animator, when the box open event is triggered, I set the original GameObject to inactive and instantiate the GameObject with the animation (but it requires to create 2 prefabs for two different gameObject).
But none of them look proper way to do this. What is the best solution for this?

Creating a New Animation Clip in unity?

I need to know how to make a simple animation video by using the unity game engine by using Animator Component, Animator Controller, Animation Clips.
My personal best way of doing so is selecting all the sprites you wish to animate at the hirerchy and dragging them to the editor scene.
Good luck!

Vuforia-Unity, How To Move Animated Objects When Marker is Outside Camera View?

We would like to move our animated object independently from frame marker or target image even they are not visible by camera; after initial setup.
However when we run our application, our model appears on target image or frame marker but as soon as marker or target is out of camera; the animated image disappears too.
How can we keep our model animating or moving around when frame marker or image target is outside camera view?
Note: We are using UNITY 3D.
All objects that are not under rendering camera are automatically deactivated in Vuforia logic. You just have to override this property and make them active so they can continue their animation and movement.
Hope this helps.

How to avoid the model to change position on walk animation?

I downloaded Raw Mocap Data Asset from Unity from Unity Asset Store
I load any walk animation to my animator and it works fine
the issue is the animation itself changes the model position, I don't want that, I want to move by my own mechanism.
Is there anyway to disable the animation from changing position?
Turn off Root Animation on your animator. Then it will not automatically move.
http://docs.unity3d.com/Manual/RootMotion.html
It is enabled by default.
Uncheckmark here: