소스 검색

如果Entity没有挂到树上,不用执行SerializeSystem

tanghai 2 년 전
부모
커밋
9d4d4edb92
1개의 변경된 파일6개의 추가작업 그리고 0개의 파일을 삭제
  1. 6 0
      Unity/Assets/Scripts/Core/Entity/Entity.cs

+ 6 - 0
Unity/Assets/Scripts/Core/Entity/Entity.cs

@@ -871,6 +871,12 @@ namespace ET
 
         public override void BeginInit()
         {
+            // 如果没有挂到树上,不用执行SerializeSystem
+            if (this.iScene == null)
+            {
+                return;
+            }
+            
             if (this is not ISerializeToEntity && !this.IsSerilizeWithParent)
             {
                 return;