com.artromskiy.deltaecs.unity 0.0.54 → 0.0.57

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,11 +1,14 @@
1
1
  using System;
2
2
  using System.Collections.Generic;
3
3
  using System.Linq;
4
+
4
5
  using Delta;
5
6
  using Delta.ECS;
6
7
  using Delta.ECS.Integration;
8
+
7
9
  using UnityEditor;
8
10
  using UnityEditor.UIElements;
11
+
9
12
  using UnityEngine;
10
13
  using UnityEngine.UIElements;
11
14
 
@@ -28,6 +31,8 @@ namespace Delta.ECS.Unity.Editor
28
31
  private EntityAuthoring _authoringEntity;
29
32
  private ComponentId[] _runtimeComponentBuffer;
30
33
  private ComponentId[] _runtimeComponentIds;
34
+
35
+ internal int ComponentCount => _componentEntries.Count;
31
36
  private SceneAuthoring Authoring => _target.Authoring;
32
37
 
33
38
  public SceneEntityInspectorView(SelectionProxy proxy)
@@ -94,16 +99,141 @@ namespace Delta.ECS.Unity.Editor
94
99
  return _root;
95
100
  }
96
101
 
102
+ internal void ScheduleRefreshContent() => _root.schedule.Execute(RefreshContent);
103
+
104
+ private static VisualElement BuildViewField(GameObject currentView, Action<GameObject> onChanged)
105
+ {
106
+ var row = new VisualElement();
107
+ row.AddToClassList("ecs-view-binding");
108
+
109
+ var field = new ObjectField("Unity View")
110
+ {
111
+ objectType = typeof(GameObject),
112
+ allowSceneObjects = true,
113
+ value = currentView
114
+ };
115
+ AddInspectorFieldClasses(field);
116
+ row.Add(field);
117
+
118
+ var unbind = new Button(() => field.value = null)
119
+ {
120
+ text = "Unbind",
121
+ tooltip = "Remove the GameObject binding from this entity"
122
+ };
123
+ unbind.AddToClassList("ecs-action-button");
124
+ unbind.SetEnabled(currentView != null);
125
+ field.RegisterValueChangedCallback(evt =>
126
+ {
127
+ GameObject nextView = evt.newValue as GameObject;
128
+ unbind.SetEnabled(nextView != null);
129
+ onChanged(nextView);
130
+ });
131
+ row.Add(unbind);
132
+ return row;
133
+ }
134
+
135
+ private static void AddEntityInfo(VisualElement card, Entity entity, string stableId)
136
+ {
137
+ var idRow = new VisualElement { pickingMode = PickingMode.Ignore };
138
+ idRow.AddToClassList("ecs-entity-id-row");
139
+ idRow.Add(CreateEntityMetadata($"EntityId: {entity.Index}"));
140
+ idRow.Add(CreateEntityMetadata($"Generation: {entity.Generation}"));
141
+ card.Add(idRow);
142
+ card.Add(CreateEntityMetadata($"StableId: {(string.IsNullOrEmpty(stableId) ? "—" : stableId)}"));
143
+ }
144
+
145
+ private static Label CreateEntityMetadata(string text)
146
+ {
147
+ var label = CreateClassLabel(text, "ecs-entity-metadata");
148
+ label.pickingMode = PickingMode.Ignore;
149
+ label.style.minHeight = EditorGUIUtility.singleLineHeight;
150
+ return label;
151
+ }
152
+
153
+ private static ToolbarMenu CreateComponentMenu()
154
+ {
155
+ var menu = new ToolbarMenu { text = "⋮" };
156
+ menu.AddToClassList("ecs-component-menu");
157
+ menu.Q<VisualElement>(className: ToolbarMenu.arrowUssClassName)?.AddToClassList("ecs-component-menu-arrow");
158
+ menu.RegisterCallback<AttachToPanelEvent>(_ =>
159
+ menu.Q<VisualElement>(className: ToolbarMenu.arrowUssClassName)?.AddToClassList("ecs-component-menu-arrow"));
160
+ menu.RegisterCallback<PointerDownEvent>(evt => evt.StopPropagation());
161
+ menu.RegisterCallback<ClickEvent>(evt => evt.StopPropagation());
162
+ return menu;
163
+ }
164
+
165
+ private static Button CreateRemoveComponentButton(Action removeComponent)
166
+ {
167
+ var button = new Button(removeComponent) { text = "×", tooltip = "Remove component" };
168
+ button.AddToClassList("ecs-component-remove");
169
+ button.RegisterCallback<PointerDownEvent>(evt => evt.StopPropagation());
170
+ button.RegisterCallback<ClickEvent>(evt => evt.StopPropagation());
171
+ return button;
172
+ }
173
+
174
+ private static void AddHeaderAction(Toggle header, VisualElement action)
175
+ {
176
+ header.Add(action);
177
+ }
178
+
179
+ private static void AddInspectorFieldClasses(VisualElement field)
180
+ {
181
+ field.AddToClassList(BaseField<float>.alignedFieldUssClassName);
182
+ field.AddToClassList("ecs-value-field");
183
+ }
184
+
185
+ private static Label CreateClassLabel(string text, string className)
186
+ {
187
+ var label = new Label(text);
188
+ label.AddToClassList(className);
189
+ return label;
190
+ }
191
+
192
+ private static Label CreateEntityIcon() => CreateClassLabel("◆", "ecs-entity-icon");
193
+
194
+ private static ComponentDescriptor? TryGetDescriptor(ComponentData data,
195
+ IReadOnlyDictionary<ulong, ComponentDescriptor> descriptors)
196
+ {
197
+ ulong? schema = GetSchemaId(data);
198
+ return schema.HasValue && descriptors.TryGetValue(schema.Value, out ComponentDescriptor descriptor)
199
+ ? descriptor
200
+ : null;
201
+ }
202
+
203
+ private static string GetComponentMenuPath(ComponentDescriptor descriptor)
204
+ {
205
+ string namespacePath = descriptor.ValueType.Namespace?.Replace('.', '/') ?? string.Empty;
206
+ string shortName = GetShortTypeName(descriptor.ValueType);
207
+ return string.IsNullOrEmpty(namespacePath) ? shortName : $"{namespacePath}/{shortName}";
208
+ }
209
+
210
+ private static string GetShortTypeName(Type type)
211
+ {
212
+ string name = type.Name;
213
+ int genericMarker = name.IndexOf('`');
214
+ return genericMarker < 0 ? name : name.Substring(0, genericMarker);
215
+ }
216
+
217
+ private static ulong? GetSchemaId(ComponentData data)
218
+ {
219
+ return data != null && data.TryGetSchemaId(out SchemaId schema) ? schema.Value : null;
220
+ }
221
+
222
+ private static bool IsComponentExpanded(ulong schema) =>
223
+ InspectorState.instance.IsComponentExpanded(schema);
224
+
225
+ private static void SetComponentExpanded(ulong schema, bool expanded) =>
226
+ InspectorState.instance.SetComponentExpanded(schema, expanded);
227
+
228
+ private static int GetComponentOrder(ulong schema) =>
229
+ InspectorState.instance.GetComponentOrder(schema);
230
+
97
231
  private void OnEntitySelectionChanged()
98
232
  {
99
233
  SyncSelection();
100
234
  RefreshContent();
101
235
  }
102
236
 
103
- internal int ComponentCount => _componentEntries.Count;
104
-
105
- internal void ScheduleRefreshContent() => _root.schedule.Execute(RefreshContent);
106
-
107
237
  private void OnAuthoringChanged(SceneAuthoring changedAuthoring)
108
238
  {
109
239
  if (changedAuthoring != Authoring || EditorApplication.isPlayingOrWillChangePlaymode)
@@ -284,55 +414,6 @@ namespace Delta.ECS.Unity.Editor
284
414
  });
285
415
  }
286
416
 
287
- private static VisualElement BuildViewField(GameObject currentView, Action<GameObject> onChanged)
288
- {
289
- var row = new VisualElement();
290
- row.AddToClassList("ecs-view-binding");
291
-
292
- var field = new ObjectField("Unity View")
293
- {
294
- objectType = typeof(GameObject),
295
- allowSceneObjects = true,
296
- value = currentView
297
- };
298
- AddInspectorFieldClasses(field);
299
- row.Add(field);
300
-
301
- var unbind = new Button(() => field.value = null)
302
- {
303
- text = "Unbind",
304
- tooltip = "Remove the GameObject binding from this entity"
305
- };
306
- unbind.AddToClassList("ecs-action-button");
307
- unbind.SetEnabled(currentView != null);
308
- field.RegisterValueChangedCallback(evt =>
309
- {
310
- GameObject nextView = evt.newValue as GameObject;
311
- unbind.SetEnabled(nextView != null);
312
- onChanged(nextView);
313
- });
314
- row.Add(unbind);
315
- return row;
316
- }
317
-
318
- private static void AddEntityInfo(VisualElement card, Entity entity, string stableId)
319
- {
320
- var idRow = new VisualElement { pickingMode = PickingMode.Ignore };
321
- idRow.AddToClassList("ecs-entity-id-row");
322
- idRow.Add(CreateEntityMetadata($"EntityId: {entity.Index}"));
323
- idRow.Add(CreateEntityMetadata($"Generation: {entity.Generation}"));
324
- card.Add(idRow);
325
- card.Add(CreateEntityMetadata($"StableId: {(string.IsNullOrEmpty(stableId) ? "—" : stableId)}"));
326
- }
327
-
328
- private static Label CreateEntityMetadata(string text)
329
- {
330
- var label = CreateClassLabel(text, "ecs-entity-metadata");
331
- label.pickingMode = PickingMode.Ignore;
332
- label.style.minHeight = EditorGUIUtility.singleLineHeight;
333
- return label;
334
- }
335
-
336
417
  private VisualElement BuildAuthoringComponentCard(EntityAuthoring authoring, ComponentData data, ComponentDescriptor descriptor)
337
418
  {
338
419
  return BuildComponentCard(descriptor, body =>
@@ -463,32 +544,6 @@ namespace Delta.ECS.Unity.Editor
463
544
  }
464
545
  }
465
546
 
466
- private static ToolbarMenu CreateComponentMenu()
467
- {
468
- var menu = new ToolbarMenu { text = "⋮" };
469
- menu.AddToClassList("ecs-component-menu");
470
- menu.Q<VisualElement>(className: ToolbarMenu.arrowUssClassName)?.AddToClassList("ecs-component-menu-arrow");
471
- menu.RegisterCallback<AttachToPanelEvent>(_ =>
472
- menu.Q<VisualElement>(className: ToolbarMenu.arrowUssClassName)?.AddToClassList("ecs-component-menu-arrow"));
473
- menu.RegisterCallback<PointerDownEvent>(evt => evt.StopPropagation());
474
- menu.RegisterCallback<ClickEvent>(evt => evt.StopPropagation());
475
- return menu;
476
- }
477
-
478
- private static Button CreateRemoveComponentButton(Action removeComponent)
479
- {
480
- var button = new Button(removeComponent) { text = "×", tooltip = "Remove component" };
481
- button.AddToClassList("ecs-component-remove");
482
- button.RegisterCallback<PointerDownEvent>(evt => evt.StopPropagation());
483
- button.RegisterCallback<ClickEvent>(evt => evt.StopPropagation());
484
- return button;
485
- }
486
-
487
- private static void AddHeaderAction(Toggle header, VisualElement action)
488
- {
489
- header.Add(action);
490
- }
491
-
492
547
  private void DrawEditableValue(VisualElement body, EntityAuthoring authoring, ComponentData data,
493
548
  ComponentDescriptor descriptor, object value)
494
549
  {
@@ -560,12 +615,6 @@ namespace Delta.ECS.Unity.Editor
560
615
  return fieldControl;
561
616
  }
562
617
 
563
- private static void AddInspectorFieldClasses(VisualElement field)
564
- {
565
- field.AddToClassList(BaseField<float>.alignedFieldUssClassName);
566
- field.AddToClassList("ecs-value-field");
567
- }
568
-
569
618
  private void BuildRuntimeEntity()
570
619
  {
571
620
  _runtimeBindings.Clear();
@@ -890,15 +939,6 @@ namespace Delta.ECS.Unity.Editor
890
939
  return value?.ToString() ?? "None";
891
940
  }
892
941
 
893
- private static Label CreateClassLabel(string text, string className)
894
- {
895
- var label = new Label(text);
896
- label.AddToClassList(className);
897
- return label;
898
- }
899
-
900
- private static Label CreateEntityIcon() => CreateClassLabel("◆", "ecs-entity-icon");
901
-
902
942
  private void RefreshRuntimeView()
903
943
  {
904
944
  if (SyncSelection())
@@ -1058,29 +1098,6 @@ namespace Delta.ECS.Unity.Editor
1058
1098
  .ToArray();
1059
1099
  }
1060
1100
 
1061
- private static ComponentDescriptor? TryGetDescriptor(ComponentData data,
1062
- IReadOnlyDictionary<ulong, ComponentDescriptor> descriptors)
1063
- {
1064
- ulong? schema = GetSchemaId(data);
1065
- return schema.HasValue && descriptors.TryGetValue(schema.Value, out ComponentDescriptor descriptor)
1066
- ? descriptor
1067
- : null;
1068
- }
1069
-
1070
- private static string GetComponentMenuPath(ComponentDescriptor descriptor)
1071
- {
1072
- string namespacePath = descriptor.ValueType.Namespace?.Replace('.', '/') ?? string.Empty;
1073
- string shortName = GetShortTypeName(descriptor.ValueType);
1074
- return string.IsNullOrEmpty(namespacePath) ? shortName : $"{namespacePath}/{shortName}";
1075
- }
1076
-
1077
- private static string GetShortTypeName(Type type)
1078
- {
1079
- string name = type.Name;
1080
- int genericMarker = name.IndexOf('`');
1081
- return genericMarker < 0 ? name : name.Substring(0, genericMarker);
1082
- }
1083
-
1084
1101
  private void AddComponent(EntityAuthoring authoring, ComponentDescriptor descriptor)
1085
1102
  {
1086
1103
  Undo.RecordObject(Authoring, $"Add {GetShortTypeName(descriptor.ValueType)}");
@@ -1138,20 +1155,6 @@ namespace Delta.ECS.Unity.Editor
1138
1155
  RefreshContent();
1139
1156
  }
1140
1157
 
1141
- private static ulong? GetSchemaId(ComponentData data)
1142
- {
1143
- return data != null && data.TryGetSchemaId(out SchemaId schema) ? schema.Value : null;
1144
- }
1145
-
1146
- private static bool IsComponentExpanded(ulong schema) =>
1147
- InspectorState.instance.IsComponentExpanded(schema);
1148
-
1149
- private static void SetComponentExpanded(ulong schema, bool expanded) =>
1150
- InspectorState.instance.SetComponentExpanded(schema, expanded);
1151
-
1152
- private static int GetComponentOrder(ulong schema) =>
1153
- InspectorState.instance.GetComponentOrder(schema);
1154
-
1155
1158
  private void MoveComponent(ulong schema, int direction)
1156
1159
  {
1157
1160
  int index = _componentEntries.FindIndex(entry => entry.Descriptor?.Schema.Value == schema);
@@ -1,6 +1,9 @@
1
1
  using System.Collections.Generic;
2
+
2
3
  using Unity.Hierarchy;
4
+
3
5
  using UnityEditor;
6
+
4
7
  using UnityEngine;
5
8
 
6
9
  namespace Delta.ECS.Unity.Editor
@@ -1,4 +1,5 @@
1
1
  using UnityEditor;
2
+
2
3
  using UnityEngine.UIElements;
3
4
 
4
5
  namespace Delta.ECS.Unity.Editor
@@ -12,6 +13,8 @@ namespace Delta.ECS.Unity.Editor
12
13
 
13
14
  public override bool RequiresConstantRepaint() => EditorApplication.isPlaying;
14
15
 
16
+ public override VisualElement CreateInspectorGUI() => _view.CreateGUI();
17
+
15
18
  private void OnEnable()
16
19
  {
17
20
  _view?.Dispose();
@@ -27,7 +30,5 @@ namespace Delta.ECS.Unity.Editor
27
30
  _view?.Dispose();
28
31
  _view = null;
29
32
  }
30
-
31
- public override VisualElement CreateInspectorGUI() => _view.CreateGUI();
32
33
  }
33
34
  }
package/README.md CHANGED
@@ -18,7 +18,7 @@ Add the npm-compatible registry and package to the Unity project's
18
18
  }
19
19
  ],
20
20
  "dependencies": {
21
- "com.artromskiy.deltaecs.unity": "0.0.54"
21
+ "com.artromskiy.deltaecs.unity": "0.0.57"
22
22
  }
23
23
  }
24
24
  ```
@@ -1,7 +1,9 @@
1
1
  using System;
2
2
  using System.Collections.Generic;
3
+
3
4
  using Delta.ECS;
4
5
  using Delta.ECS.Integration;
6
+
5
7
  using UnityEngine;
6
8
 
7
9
  namespace Delta.ECS.Unity
@@ -17,12 +19,26 @@ namespace Delta.ECS.Unity
17
19
  public string Json => _json;
18
20
  public IReadOnlyList<EntityReference> EntityReferences => _entityReferences ??= new List<EntityReference>();
19
21
 
22
+ private List<EntityReference> EntityReferenceList =>
23
+ _entityReferences ??= new List<EntityReference>();
24
+
20
25
  public ComponentData(ulong schemaId, string json)
21
26
  {
22
27
  _schemaId = schemaId.ToString("X16");
23
28
  _json = json;
24
29
  }
25
30
 
31
+ public static ComponentData CreateDefault(ComponentDescriptor descriptor)
32
+ {
33
+ if (descriptor.IsTag)
34
+ {
35
+ return new ComponentData(descriptor.Schema.Value, "{}");
36
+ }
37
+
38
+ object value = Activator.CreateInstance(descriptor.ValueType);
39
+ return new ComponentData(descriptor.Schema.Value, JsonUtility.ToJson(value));
40
+ }
41
+
26
42
  public bool TryGetSchemaId(out SchemaId schemaId)
27
43
  {
28
44
  if (ulong.TryParse(_schemaId, System.Globalization.NumberStyles.HexNumber, null, out ulong value))
@@ -93,19 +109,5 @@ namespace Delta.ECS.Unity
93
109
 
94
110
  return string.Empty;
95
111
  }
96
-
97
- private List<EntityReference> EntityReferenceList =>
98
- _entityReferences ??= new List<EntityReference>();
99
-
100
- public static ComponentData CreateDefault(ComponentDescriptor descriptor)
101
- {
102
- if (descriptor.IsTag)
103
- {
104
- return new ComponentData(descriptor.Schema.Value, "{}");
105
- }
106
-
107
- object value = Activator.CreateInstance(descriptor.ValueType);
108
- return new ComponentData(descriptor.Schema.Value, JsonUtility.ToJson(value));
109
- }
110
112
  }
111
113
  }
@@ -1,5 +1,6 @@
1
1
  using System;
2
2
  using System.Collections.Generic;
3
+
3
4
  using UnityEngine;
4
5
 
5
6
  namespace Delta.ECS.Unity
@@ -1,6 +1,7 @@
1
1
  #nullable enable
2
2
 
3
3
  using System;
4
+
4
5
  using Delta.ECS;
5
6
 
6
7
  namespace Delta.ECS.Unity
@@ -17,6 +18,12 @@ namespace Delta.ECS.Unity
17
18
  /// <summary>Gets whether this context refers to a live entity.</summary>
18
19
  public bool IsAlive => World != null && World.IsAlive(Entity);
19
20
 
21
+ internal EntityContext(World world, Entity entity)
22
+ {
23
+ World = world;
24
+ Entity = entity;
25
+ }
26
+
20
27
  /// <summary>Reports whether the entity owns the specified component registration.</summary>
21
28
  public bool Has(ComponentId componentId) => World?.Has(Entity, componentId) ?? false;
22
29
 
@@ -67,12 +74,6 @@ namespace Delta.ECS.Unity
67
74
  /// <summary>Gets a read-only reference to the specified registration of <typeparamref name="T"/>.</summary>
68
75
  public ref readonly T GetReadRef<T>(ComponentId componentId) => ref GetWorld().GetReadRef<T>(Entity, componentId);
69
76
 
70
- internal EntityContext(World world, Entity entity)
71
- {
72
- World = world;
73
- Entity = entity;
74
- }
75
-
76
77
  private World GetWorld()
77
78
  => World ?? UnityThrowHelpers.ThrowMissingEntityContextWorld();
78
79
  }
@@ -1,4 +1,5 @@
1
1
  using System;
2
+
2
3
  using UnityEngine;
3
4
 
4
5
  namespace Delta.ECS.Unity
@@ -1,6 +1,8 @@
1
1
  using System;
2
2
  using System.Collections.Generic;
3
+
3
4
  using Delta.ECS;
5
+
4
6
  using Unity.Properties;
5
7
 
6
8
  namespace Delta.ECS.Unity
@@ -75,11 +77,11 @@ namespace Delta.ECS.Unity
75
77
 
76
78
  private sealed class ReadPathVisitor : IPropertyBagVisitor
77
79
  {
78
- private readonly string[] _path;
79
- private readonly int _pathIndex;
80
80
 
81
81
  internal object Value;
82
82
  internal bool Found;
83
+ private readonly string[] _path;
84
+ private readonly int _pathIndex;
83
85
 
84
86
  internal ReadPathVisitor(string[] path, int pathIndex)
85
87
  {
@@ -121,12 +123,12 @@ namespace Delta.ECS.Unity
121
123
 
122
124
  private sealed class WritePathVisitor : IPropertyBagVisitor
123
125
  {
126
+
127
+ internal bool Succeeded;
124
128
  private readonly string[] _path;
125
129
  private readonly int _pathIndex;
126
130
  private readonly object _value;
127
131
 
128
- internal bool Succeeded;
129
-
130
132
  internal WritePathVisitor(string[] path, int pathIndex, object value)
131
133
  {
132
134
  _path = path;
@@ -1,5 +1,6 @@
1
1
  using System;
2
2
  using System.Collections.Generic;
3
+
3
4
  using UnityEngine;
4
5
  using UnityEngine.SceneManagement;
5
6
 
@@ -25,6 +26,46 @@ namespace Delta.ECS.Unity
25
26
 
26
27
  internal SceneData SceneData => _sceneData ??= new SceneData();
27
28
 
29
+ internal static SceneAuthoring FindForScene(Scene scene)
30
+ {
31
+ if (!scene.IsValid())
32
+ {
33
+ return null;
34
+ }
35
+
36
+ SceneAuthoring[] authorings = Resources.FindObjectsOfTypeAll<SceneAuthoring>();
37
+ for (int i = 0; i < authorings.Length; i++)
38
+ {
39
+ SceneAuthoring authoring = authorings[i];
40
+ if (authoring != null && authoring.gameObject.scene == scene)
41
+ {
42
+ return authoring;
43
+ }
44
+ }
45
+
46
+ return null;
47
+ }
48
+
49
+ internal static SceneAuthoring GetOrCreateForScene(Scene scene)
50
+ {
51
+ if (!scene.IsValid() || !scene.isLoaded)
52
+ {
53
+ UnityThrowHelpers.ThrowArgument("Scene authoring requires a valid, loaded scene.", nameof(scene));
54
+ }
55
+
56
+ SceneAuthoring existing = FindForScene(scene);
57
+ if (existing != null)
58
+ {
59
+ return existing;
60
+ }
61
+
62
+ var authoringObject = new GameObject(AuthoringObjectName);
63
+ SceneManager.MoveGameObjectToScene(authoringObject, scene);
64
+ SceneAuthoring authoring = authoringObject.AddComponent<SceneAuthoring>();
65
+ authoringObject.hideFlags |= HideFlags.HideInHierarchy;
66
+ return authoring;
67
+ }
68
+
28
69
  internal bool TryGetView(string stableId, out GameObject view)
29
70
  {
30
71
  EnsureBindingIndex();
@@ -84,46 +125,6 @@ namespace Delta.ECS.Unity
84
125
 
85
126
  internal bool RemoveView(string stableId) => SetView(stableId, null);
86
127
 
87
- internal static SceneAuthoring FindForScene(Scene scene)
88
- {
89
- if (!scene.IsValid())
90
- {
91
- return null;
92
- }
93
-
94
- SceneAuthoring[] authorings = Resources.FindObjectsOfTypeAll<SceneAuthoring>();
95
- for (int i = 0; i < authorings.Length; i++)
96
- {
97
- SceneAuthoring authoring = authorings[i];
98
- if (authoring != null && authoring.gameObject.scene == scene)
99
- {
100
- return authoring;
101
- }
102
- }
103
-
104
- return null;
105
- }
106
-
107
- internal static SceneAuthoring GetOrCreateForScene(Scene scene)
108
- {
109
- if (!scene.IsValid() || !scene.isLoaded)
110
- {
111
- UnityThrowHelpers.ThrowArgument("Scene authoring requires a valid, loaded scene.", nameof(scene));
112
- }
113
-
114
- SceneAuthoring existing = FindForScene(scene);
115
- if (existing != null)
116
- {
117
- return existing;
118
- }
119
-
120
- var authoringObject = new GameObject(AuthoringObjectName);
121
- SceneManager.MoveGameObjectToScene(authoringObject, scene);
122
- SceneAuthoring authoring = authoringObject.AddComponent<SceneAuthoring>();
123
- authoringObject.hideFlags |= HideFlags.HideInHierarchy;
124
- return authoring;
125
- }
126
-
127
128
  private void OnValidate()
128
129
  {
129
130
  SceneData.EnsureStableIds();
@@ -1,5 +1,6 @@
1
1
  using System;
2
2
  using System.Collections.Generic;
3
+
3
4
  using UnityEngine;
4
5
 
5
6
  namespace Delta.ECS.Unity