Hi all!
I saw this post :
"
- using UnityEngine;
- using UnityEditor;
- using System.Collections;
- public class TestAnim : Editor
- {
- [UnityEditor.MenuItem(“TestAnim/Create Test”)]
- public static void CreateAnim ()
- {
- AnimationClip clip = new AnimationClip();
- clip.SetCurve(“”, typeof(Transform), “position.x”, AnimationCurve.EaseInOut(0, 0, 2, 10));
- clip.SetCurve(“”, typeof(Transform), “position.y”, AnimationCurve.EaseInOut(0, 10, 2, 0));
- clip.SetCurve(“”, typeof(Transform), “position.z”, AnimationCurve.EaseInOut(0, 5, 2, 2));
- AssetDatabase.CreateAsset(clip, “Assets/Test.anim”);
- }
- }
"
and I was wondering, how to use this? How to create an element and add this script to the element so The animation start. Is it possible to add a delay before launching the element? And is it possible to get the basic transformation of the GameObject this script is attached?
What I want to achieve is to create severals objects on a scene, and make them all have the same animation but with 1 second between each.
(For example, all object start in the sky, and they fall down 1 by 1 in front of the astonished eyes of the camera).
I am quite new with Unity, and i’m probably not searching at the good places, but apart this post, I only found posts about how just start animation that are already created …
Sorry if this post already exists,
If someone can help me, I would be really happy!
Thanks all, and have a nice evening!