NextAnimPlayLoop Preview calss.
간단하게 캐릭터 애니메이션을 인스펙터에 따로 리스트로 등록 해서 스페이스바를 눌러 다음 애니 다음 애니를 프리뷰 해 보고 싶을 때.
간단히 아래와 같이 구현.
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
public class NextAnimPlayLoop : MonoBehaviour {
public List aniClipList = new List();
public int myIterator = 0;
// Use this for initialization
void Start ()
{
animation.clip = aniClipList[myIterator];
animation.Play();
Debug.Log(animation.clip.name);
}
// Update is called once per frame
void Update ()
{
if(Input.GetKeyDown(KeyCode.Space))
{
if(myIterator >= aniClipList.Capacity)
{
myIterator = 0;
}
else
{
myIterator++;
myIterator %= aniClipList.Count;
}
animation.clip = aniClipList[myIterator];
animation.Play();
}
}
}
Game Developer Leegoon copyright all right reserved since 2010.


Comments
Post a Comment
덧글쓰기 기능 있는거 아시죠? ㅋㅋ