[unity] Fixed SkeletonDataAsset auto-update mechanism on .json file change for both scene view and inspector. Closes #1330.

This commit is contained in:
Harald Csaszar 2019-04-18 19:53:03 +02:00
parent 470c2f5953
commit bf93b00e6b
2 changed files with 15 additions and 2 deletions

View File

@ -93,6 +93,12 @@ namespace Spine.Unity.Editor {
OnDestroy(); OnDestroy();
} }
public void UpdateSkeletonData () {
preview.Clear();
InitializeEditor();
EditorUtility.SetDirty(targetSkeletonDataAsset);
}
void InitializeEditor () { void InitializeEditor () {
SpineEditorUtilities.ConfirmInitialization(); SpineEditorUtilities.ConfirmInitialization();
targetSkeletonDataAsset = (SkeletonDataAsset)target; targetSkeletonDataAsset = (SkeletonDataAsset)target;

View File

@ -800,6 +800,12 @@ namespace Spine.Unity.Editor {
break; break;
#endif #endif
} }
SkeletonDataAssetInspector[] skeletonDataInspectors = Resources.FindObjectsOfTypeAll<SkeletonDataAssetInspector>();
foreach (var inspector in skeletonDataInspectors) {
inspector.UpdateSkeletonData();
}
// Any post processing of images // Any post processing of images
// Under some circumstances (e.g. on first import) SkeletonGraphic objects // Under some circumstances (e.g. on first import) SkeletonGraphic objects
@ -870,6 +876,7 @@ namespace Spine.Unity.Editor {
if (currentHash != null) if (currentHash != null)
EditorPrefs.SetString(guid + "_hash", currentHash); EditorPrefs.SetString(guid + "_hash", currentHash);
} }
DataReloadHandler.ReloadSceneSkeletonComponents(skeletonDataAsset);
} }
} }
} }