public static Spine.AnimationState ReloadSkeletonDataAsset (GameObject g,SkeletonDataAsset res,string skinname) {
SkeletonAnimation skeletonAnimation = g.GetComponent<SkeletonAnimation>();
if (skeletonAnimation == null)
{
Debug.LogError("当前对象没有绑定SkeletonAnimation组件");
return null;
}
//加载SkeletonDataAsset资源
if (res == null)
return null;
//不清除一次之前的数据会有超出边界的报错啥的
skeletonAnimation.ClearState();
//将加载的资源赋值给SkeletonAnimation对象
skeletonAnimation.skeletonDataAsset = res;
//传递true强制初始化一次资源,这样才能真的刷新SkeletonAnimation和MeshReder中的资源和材质,并加载到当前对象中
skeletonAnimation.Initialize(true);
Spine.AnimationState state =null;
if(skeletonAnimation!=null&&skinname!=null)
state= SpineUtil.AllChange(skeletonAnimation,"kaihua");
return state;
}
Sorry,this is the method.