mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2025-12-21 01:36:02 +08:00
[unity] SkeletonUtility spawn methods were not saved in Prefab mode. Closes #1481.
This commit is contained in:
parent
4c1e01474e
commit
9483df76b5
@ -143,21 +143,25 @@ namespace Spine.Unity.Editor {
|
||||
}
|
||||
|
||||
void SpawnFollowHierarchy () {
|
||||
Undo.RegisterCompleteObjectUndo(skeletonUtility, "Spawn Hierarchy");
|
||||
Selection.activeGameObject = skeletonUtility.SpawnHierarchy(SkeletonUtilityBone.Mode.Follow, true, true, true);
|
||||
AttachIconsToChildren(skeletonUtility.boneRoot);
|
||||
}
|
||||
|
||||
void SpawnFollowHierarchyRootOnly () {
|
||||
Undo.RegisterCompleteObjectUndo(skeletonUtility, "Spawn Root");
|
||||
Selection.activeGameObject = skeletonUtility.SpawnRoot(SkeletonUtilityBone.Mode.Follow, true, true, true);
|
||||
AttachIconsToChildren(skeletonUtility.boneRoot);
|
||||
}
|
||||
|
||||
void SpawnOverrideHierarchy () {
|
||||
Undo.RegisterCompleteObjectUndo(skeletonUtility, "Spawn Hierarchy");
|
||||
Selection.activeGameObject = skeletonUtility.SpawnHierarchy(SkeletonUtilityBone.Mode.Override, true, true, true);
|
||||
AttachIconsToChildren(skeletonUtility.boneRoot);
|
||||
}
|
||||
|
||||
void SpawnOverrideHierarchyRootOnly () {
|
||||
Undo.RegisterCompleteObjectUndo(skeletonUtility, "Spawn Root");
|
||||
Selection.activeGameObject = skeletonUtility.SpawnRoot(SkeletonUtilityBone.Mode.Override, true, true, true);
|
||||
AttachIconsToChildren(skeletonUtility.boneRoot);
|
||||
}
|
||||
|
||||
@ -70,6 +70,10 @@ namespace Spine.Unity {
|
||||
|
||||
public static PolygonCollider2D AddBoundingBoxGameObject (string name, BoundingBoxAttachment box, Slot slot, Transform parent, bool isTrigger = true) {
|
||||
var go = new GameObject("[BoundingBox]" + (string.IsNullOrEmpty(name) ? box.Name : name));
|
||||
#if UNITY_EDITOR
|
||||
if (!Application.isPlaying)
|
||||
UnityEditor.Undo.RegisterCreatedObjectUndo(go, "Spawn BoundingBox");
|
||||
# endif
|
||||
var got = go.transform;
|
||||
got.parent = parent;
|
||||
got.localPosition = Vector3.zero;
|
||||
@ -291,6 +295,10 @@ namespace Spine.Unity {
|
||||
return boneRoot;
|
||||
|
||||
boneRoot = new GameObject("SkeletonUtility-SkeletonRoot").transform;
|
||||
#if UNITY_EDITOR
|
||||
if (!Application.isPlaying)
|
||||
UnityEditor.Undo.RegisterCreatedObjectUndo(boneRoot.gameObject, "Spawn Bone");
|
||||
#endif
|
||||
boneRoot.parent = transform;
|
||||
boneRoot.localPosition = Vector3.zero;
|
||||
boneRoot.localRotation = Quaternion.identity;
|
||||
@ -330,6 +338,10 @@ namespace Spine.Unity {
|
||||
|
||||
public GameObject SpawnBone (Bone bone, Transform parent, SkeletonUtilityBone.Mode mode, bool pos, bool rot, bool sca) {
|
||||
GameObject go = new GameObject(bone.Data.Name);
|
||||
#if UNITY_EDITOR
|
||||
if (!Application.isPlaying)
|
||||
UnityEditor.Undo.RegisterCreatedObjectUndo(go, "Spawn Bone");
|
||||
#endif
|
||||
var goTransform = go.transform;
|
||||
goTransform.parent = parent;
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user