浏览代码

[unity] Fixed NullReferenceException upon SkeletonGraphic drag&drop instantiation. Closes #2292.

Harald Csaszar 2 年之前
父节点
当前提交
7883f0fafd
共有 1 个文件被更改,包括 1 次插入2 次删除
  1. 1 2
      spine-unity/Assets/Spine/Runtime/spine-unity/Components/SkeletonGraphic.cs

+ 1 - 2
spine-unity/Assets/Spine/Runtime/spine-unity/Components/SkeletonGraphic.cs

@@ -278,7 +278,6 @@ namespace Spine.Unity {
 		}
 
 		protected override void Awake () {
-
 			base.Awake();
 			this.onCullStateChanged.AddListener(OnCullStateChanged);
 
@@ -293,7 +292,7 @@ namespace Spine.Unity {
 				}
 #endif
 				Initialize(false);
-				Rebuild(CanvasUpdate.PreRender);
+				if (this.IsValid) Rebuild(CanvasUpdate.PreRender);
 			}
 
 #if UNITY_EDITOR