unity內讀取多個動作代码
using UnityEngine;using System.Collections;
public class Test : MonoBehaviour
{
public GameObject ani;
public string[] aniName = null;
void Start()
{
//讀取動作
string[] aniName001 = new string;
int i = 0;
if (!ani.Equals(null))
{
foreach (AnimationState state in ani.animation)
{
aniName001 = state.name;
}
aniName = new string;
for (int j = 0; j < aniName.Length; j++)
{
aniName = aniName001;
}
}
}
}
void Update()
{
//播放動作
for(int i=1;i<3;i++)
{
if (!ani.animation.isPlaying)
{
ani.animation.Play(aniName);
}
}
}
} 很不错 好帖就是要顶 真心顶 难得一见的好帖 不错不错 好帖就是要顶 真心顶 难得一见的好帖 很好哦