mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2025-12-21 01:36:02 +08:00
- Properly update mesh data when switching platform in editor.
This commit is contained in:
parent
99c81b6b01
commit
aee230b156
@ -10,7 +10,7 @@ using Spine;
|
||||
[ExecuteInEditMode]
|
||||
[RequireComponent(typeof(MeshFilter))]
|
||||
[RequireComponent(typeof(MeshRenderer))]
|
||||
public class tk2dSpineSkeleton : MonoBehaviour {
|
||||
public class tk2dSpineSkeleton : MonoBehaviour, tk2dRuntime.ISpriteCollectionForceBuild {
|
||||
|
||||
/*
|
||||
*/
|
||||
@ -188,4 +188,15 @@ public class tk2dSpineSkeleton : MonoBehaviour {
|
||||
state.Update(Time.deltaTime * animationSpeed);
|
||||
state.Apply(skeleton);
|
||||
}
|
||||
|
||||
public bool UsesSpriteCollection(tk2dSpriteCollectionData spriteCollection) {
|
||||
return skeletonDataAsset.sprites.spriteCollection == spriteCollection;
|
||||
}
|
||||
|
||||
public void ForceBuild() {
|
||||
skeletonDataAsset.ForceUpdate();
|
||||
skeleton = new Skeleton(skeletonDataAsset.GetSkeletonData());
|
||||
|
||||
UpdateMesh();
|
||||
}
|
||||
}
|
||||
|
||||
@ -68,4 +68,8 @@ public class tk2dSpineSkeletonDataAsset : ScriptableObject {
|
||||
stateData.SetMix(fromAnimation[i],toAnimation[i],duration[i]);
|
||||
}
|
||||
}
|
||||
|
||||
public void ForceUpdate() {
|
||||
MakeSkeletonAndAnimationData();
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user