using System.Collections;
using UnityEngine;
using Spine.Unity;
namespace Game
{
//
public class SpineForAnimator : MonoBehaviour
{
public int index = 0;
public bool loop = false;
private SkeletonGraphic _ui;
private SkeletonAnimation _scene;
private int _playingIdx = -1;
private void Awake()
{
_ui = GetComponent<SkeletonGraphic>();
_scene = GetComponent<SkeletonAnimation>();
}
private void Update()
{
if (_playingIdx == index)
{
return;
}
if (_ui != null)
{
PlayUISpine();
}else if (_scene != null)
{
PlaySceneSpine();
}
}
private void PlayUISpine()
{
var animations = _ui.Skeleton.Data.Animations;
Debug.Assert(index < animations.Count, "property index can not more than animation count!");
var state = _ui.AnimationState;
var willName = animations.Items.Name;
//播放Spine动画
state.ClearTrack(0);
_ui.Skeleton.SetToSetupPose();
state.SetAnimation(0, willName, loop);
_playingIdx = index;
}
private void PlaySceneSpine()
{
var animations = _scene.skeleton.Data.Animations;
Debug.Assert(index < animations.Count, "property index can not more than animation count!");
var state = _scene.AnimationState;
var willName = animations.Items.Name;
//播放Spine动画
state.ClearTrack(0);
_scene.Skeleton.SetToSetupPose();
state.SetAnimation(0, willName, loop);
_playingIdx = index;
}
}
}
spine for unity animator 动画
unity切换动画动画循环spine切换动作脚本(老何)
tvp2013中文版
云循环
unity 天空盒跑云
unity贴图particle中多个随机播放
模型线转换成点
uv动画修改器设置
C:\Users\Administrator\Desktop\
https://chengdu665/svn/witch