Browse Source

[unity] Fixed animation not playing first time entering play mode after compilation. Related to disabled Domain/Scene reload. See #1621.

Harald Csaszar 4 years ago
parent
commit
d4654588fb

+ 10 - 0
spine-unity/Assets/Spine/Runtime/spine-unity/Components/SkeletonRenderer.cs

@@ -39,6 +39,10 @@
 #define BUILT_IN_SPRITE_MASK_COMPONENT
 #endif
 
+#if UNITY_2019_3_OR_NEWER
+#define CONFIGURABLE_ENTER_PLAY_MODE
+#endif
+
 #define SPINE_OPTIONAL_RENDEROVERRIDE
 #define SPINE_OPTIONAL_MATERIALOVERRIDE
 
@@ -276,6 +280,12 @@ namespace Spine.Unity {
 			Initialize(false);
 		}
 
+	#if UNITY_EDITOR && CONFIGURABLE_ENTER_PLAY_MODE
+		public virtual void Start () {
+			Initialize(false);
+		}
+	#endif
+
 		void OnDisable () {
 			if (clearStateOnDisable && valid)
 				ClearState();