Page 1 of 1

Unity animation import example

PostPosted: Wed Nov 07, 2012 10:26 pm
by BenChang
Screen shot 2012-11-07 at 5.20.17 PM.png
Screen shot 2012-11-07 at 5.20.17 PM.png (20.61 KiB) Viewed 846 times


Example of creating animations using file referencing in Maya, and using them in Unity.

Code: Select all
using UnityEngine;
using System.Collections;

public class controlScript : MonoBehaviour {

   // Use this for initialization
   void Start () {
      animation["idle"].wrapMode=WrapMode.Loop;
      animation["jump"].wrapMode=WrapMode.Once;
   }
   
   // Update is called once per frame
   void Update () {
      if (Input.GetKeyDown("space"))
      {
         animation.Play("jump");
         animation.CrossFadeQueued("idle",0.3f,QueueMode.CompleteOthers);
         
      }
   }
}