Hey, we're having a new issue with the Spine Runtimes failing to instantiate one of our skeletons.
Unity Version: v6000.0.11f1
Spine Runtime Version: v4.2.29 (GitHub Revision #b17595d)
The most curious part is that it properly imports, loads, and instantiated the first time. But if the code recompiles, the SkeletonAnimation immediately stops rendering and I'm unable to get it to render again properly.
None of the following work to fix the issue (nor combinations of these):
Removing and reimporting the json and atlas files
Reloading the Scene
Removing the SkeletonAnimation and trying to instantiate a new one
Restarting Unity
I was able to get it to work again, once, by removing the .spine and atlas files, removing the SkeletonAnimation, unloading the scene, restarting Unity, importing the json and atlas files, loaded the scene, and instantiated a new SkeletonAnimation with that json file. The moment Unity compiled though, it broke the SkeletonData again.
I also just noticed that somehow about a hundred of these SkeletonAnimation were added to my main control scene (we additively load our scenes, but I've never added this skeleton to our control scene).
Upon Removing and reimporting the json and atlas files we get the following error message in the console:
NullReferenceException: Object reference not set to an instance of an object
Spine.Unity.Editor.BlendModeMaterialsUtility.CreateOrLoadReplacementMaterial (Spine.AtlasRegion originalRegion, UnityEngine.Material materialTemplate, System.String materialSuffix, System.Boolean& createdNewMaterial) (at Assets/Spine/Editor/spine-unity/Editor/Utility/BlendModeMaterialsUtility.cs:210)
Spine.Unity.Editor.BlendModeMaterialsUtility.CreateForRegion (System.Collections.Generic.List`1[Spine.Unity.BlendModeMaterials+ReplacementMaterial]& replacementMaterials, System.Boolean& anyReplacementMaterialsChanged, Spine.AtlasRegion originalRegion, UnityEngine.Material materialTemplate, System.String materialSuffix, Spine.Unity.SkeletonDataAsset skeletonDataAsset) (at Assets/Spine/Editor/spine-unity/Editor/Utility/BlendModeMaterialsUtility.cs:172)
Spine.Unity.BlendModeMaterials.CreateAndAssignMaterials (Spine.Unity.SkeletonDataAsset skeletonDataAsset, Spine.Unity.BlendModeMaterials+TemplateMaterials templateMaterials, System.Boolean& anyReplacementMaterialsChanged, System.Action`1[T] clearSkeletonDataAssetFunc, System.Action`1[T] afterAssetModifiedFunc, Spine.Unity.BlendModeMaterials+CreateForRegionDelegate createForRegionFunc) (at Assets/Spine/Runtime/spine-unity/Asset Types/BlendModeMaterials.cs:173)
Spine.Unity.Editor.BlendModeMaterialsUtility.CreateAndAssignMaterials (Spine.Unity.SkeletonDataAsset skeletonDataAsset, Spine.Unity.BlendModeMaterials+TemplateMaterials templateMaterials, System.Boolean& anyReplacementMaterialsChanged) (at Assets/Spine/Editor/spine-unity/Editor/Utility/BlendModeMaterialsUtility.cs:155)
Spine.Unity.Editor.BlendModeMaterialsUtility.UpdateBlendModeMaterials (Spine.Unity.SkeletonDataAsset skeletonDataAsset, Spine.SkeletonData& skeletonData, System.Boolean upgradeFromModifierAssets) (at Assets/Spine/Editor/spine-unity/Editor/Utility/BlendModeMaterialsUtility.cs:86)
Spine.Unity.Editor.AssetUtility.IngestSpineProject (UnityEngine.TextAsset spineJson, Spine.Unity.AtlasAssetBase[] atlasAssets) (at Assets/Spine/Editor/spine-unity/Editor/Utility/AssetUtility.cs:1062)
Spine.Unity.Editor.AssetUtility.ImportSpineContent (System.String[] imported, System.Collections.Generic.List`1[T] texturesWithoutMetaFile, System.Boolean reimport) (at Assets/Spine/Editor/spine-unity/Editor/Utility/AssetUtility.cs:462)
Spine.Unity.Editor.AssetUtility.HandleOnPostprocessAllAssets (System.String[] imported, System.Collections.Generic.List`1[T] texturesWithoutMetaFile) (at Assets/Spine/Editor/spine-unity/Editor/Utility/AssetUtility.cs:117)
Spine.Unity.Editor.SpineEditorUtilities.OnPostprocessAllAssets (System.String[] imported, System.String[] deleted, System.String[] moved, System.String[] movedFromAssetPaths) (at Assets/Spine/Editor/spine-unity/Editor/Utility/SpineEditorUtilities.cs:102)
System.Reflection.RuntimeMethodInfo.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at <ce95f63947c64e4bbf5929ebe610c440>:0)
Rethrow as TargetInvocationException: Exception has been thrown by the target of an invocation.
System.Reflection.RuntimeMethodInfo.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at <ce95f63947c64e4bbf5929ebe610c440>:0)
System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) (at <ce95f63947c64e4bbf5929ebe610c440>:0)
UnityEditor.AssetPostprocessingInternal.InvokeMethod (System.Reflection.MethodInfo method, System.Object[] args) (at /Users/bokken/build/output/unity/unity/Editor/Mono/AssetPostprocessor.cs:1168)
UnityEditor.AssetPostprocessingInternal.PostprocessAllAssets (System.String[] importedAssets, System.String[] addedAssets, System.String[] deletedAssets, System.String[] movedAssets, System.String[] movedFromPathAssets, System.Boolean didDomainReload) (at /Users/bokken/build/output/unity/unity/Editor/Mono/AssetPostprocessor.cs:403)
UnityEditor.AssetPostprocessingInternal:PostprocessAllAssets(String[], String[], String[], String[], String[], Boolean)
UnityEditorInternal.InternalEditorUtility:ProjectWindowDrag(HierarchyProperty, Boolean)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr, Boolean&) (at /Users/bokken/build/output/unity/unity/Modules/IMGUI/GUIUtility.cs:219)
Upon trying to drag and drop the SkeletonData into a Scene as a SkeletonAnimation the console displays the following error:
NullReferenceException: Object reference not set to an instance of an object
Spine.Unity.Editor.EditorInstantiation.InstantiateSkeletonAnimation (Spine.Unity.SkeletonDataAsset skeletonDataAsset, Spine.Skin skin, System.Boolean destroyInvalid, System.Boolean useObjectFactory) (at Assets/Spine/Editor/spine-unity/Editor/Utility/AssetUtility.cs:1368)
Spine.Unity.Editor.SpineEditorUtilities+DragAndDropInstantiation+<>c.<ShowInstantiateContextMenu>b__2_0 (Spine.Unity.SkeletonDataAsset data) (at Assets/Spine/Editor/spine-unity/Editor/Utility/Instantiation.cs:105)
Spine.Unity.Editor.SpineEditorUtilities+DragAndDropInstantiation.HandleSkeletonComponentDrop (System.Object spawnMenuData) (at Assets/Spine/Editor/spine-unity/Editor/Utility/Instantiation.cs:150)
UnityEditor.GenericMenu.CatchMenu (System.Object userData, System.String[] options, System.Int32 selected) (at /Users/bokken/build/output/unity/unity/Editor/Mono/GUI/GenericMenu.cs:125)
I've sent the offending spine project to your email address in-case it's something wrong with our Spine file (and to potentially help you pinpoint the issue if something is wrong with the runtimes).
Thank you for your time and any help you might be able to provide!