fr.jeanf.scenemanagement 0.3.4 → 0.3.5
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.
- package/Runtime/AdditiveLoading/Id.cs +46 -5
- package/Samples/Example/RegionData/Region_00/Zones/Zone_01.asset +1 -1
- package/Samples/Example/RegionData/Region_00/Zones/Zone_02.asset +1 -1
- package/Samples/Example/RegionData/Region_00/Zones/Zone_03.asset +1 -1
- package/Samples/Example/RegionData/Region_00/Zones/Zone_04.asset +1 -1
- package/Samples/Example/RegionData/Region_00/Zones/Zone_05.asset +1 -1
- package/Samples/Example/RegionData/Region_00/Zones/Zone_06.asset +1 -1
- package/Samples/Example/RegionData/Region_00/Zones/Zone_07.asset +1 -1
- package/Samples/Example/RegionData/Region_00/Zones/Zone_08.asset +1 -1
- package/package.json +1 -1
|
@@ -36,8 +36,6 @@ namespace jeanf.scenemanagement
|
|
|
36
36
|
{
|
|
37
37
|
return id?.id;
|
|
38
38
|
}
|
|
39
|
-
|
|
40
|
-
|
|
41
39
|
}
|
|
42
40
|
|
|
43
41
|
#if UNITY_EDITOR
|
|
@@ -64,19 +62,62 @@ namespace jeanf.scenemanagement
|
|
|
64
62
|
// Access the "id" field within the "Id" class
|
|
65
63
|
SerializedProperty idProperty = property.FindPropertyRelative("id");
|
|
66
64
|
|
|
65
|
+
// Show mixed value indicator if multiple objects have different values
|
|
66
|
+
EditorGUI.showMixedValue = idProperty.hasMultipleDifferentValues;
|
|
67
|
+
|
|
67
68
|
// Draw the text field for the "id" string
|
|
68
|
-
|
|
69
|
+
EditorGUI.BeginChangeCheck();
|
|
70
|
+
string newValue = EditorGUI.TextField(fieldRect, idProperty.stringValue);
|
|
71
|
+
if (EditorGUI.EndChangeCheck())
|
|
72
|
+
{
|
|
73
|
+
idProperty.stringValue = newValue;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
// Reset mixed value display
|
|
77
|
+
EditorGUI.showMixedValue = false;
|
|
69
78
|
|
|
70
79
|
// Draw the "Generate" button
|
|
71
80
|
if (GUI.Button(buttonRect, "Generate"))
|
|
72
81
|
{
|
|
73
|
-
|
|
82
|
+
// Handle multi-object selection properly
|
|
83
|
+
GenerateUniqueIdsForAllTargets(property);
|
|
74
84
|
}
|
|
75
85
|
|
|
76
86
|
// End property drawing
|
|
77
87
|
EditorGUI.EndProperty();
|
|
78
88
|
}
|
|
79
|
-
}
|
|
80
89
|
|
|
90
|
+
private void GenerateUniqueIdsForAllTargets(SerializedProperty property)
|
|
91
|
+
{
|
|
92
|
+
// Get all target objects (handles multi-selection)
|
|
93
|
+
UnityEngine.Object[] targets = property.serializedObject.targetObjects;
|
|
94
|
+
|
|
95
|
+
// Record undo for all targets
|
|
96
|
+
Undo.RecordObjects(targets, "Generate Unique IDs");
|
|
97
|
+
|
|
98
|
+
// Generate unique ID for each target
|
|
99
|
+
foreach (UnityEngine.Object target in targets)
|
|
100
|
+
{
|
|
101
|
+
SerializedObject targetSerializedObject = new SerializedObject(target);
|
|
102
|
+
SerializedProperty targetProperty = targetSerializedObject.FindProperty(property.propertyPath);
|
|
103
|
+
SerializedProperty targetIdProperty = targetProperty.FindPropertyRelative("id");
|
|
104
|
+
|
|
105
|
+
// Generate unique GUID for each object
|
|
106
|
+
targetIdProperty.stringValue = System.Guid.NewGuid().ToString();
|
|
107
|
+
|
|
108
|
+
// Apply changes to this specific target
|
|
109
|
+
targetSerializedObject.ApplyModifiedProperties();
|
|
110
|
+
|
|
111
|
+
// Mark the asset as dirty to ensure it saves
|
|
112
|
+
EditorUtility.SetDirty(target);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
// Save all modified assets
|
|
116
|
+
AssetDatabase.SaveAssets();
|
|
117
|
+
|
|
118
|
+
// Refresh the inspector to show updated values
|
|
119
|
+
property.serializedObject.Update();
|
|
120
|
+
}
|
|
121
|
+
}
|
|
81
122
|
#endif
|
|
82
123
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "fr.jeanf.scenemanagement",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.5",
|
|
4
4
|
"displayName": "Scene Management",
|
|
5
5
|
"description": "This package contains two scene loading system, one is additive, the other is to load subscenes. \nBoth system are living side-by-side.\nThe dynamic systems handles the loading of all static content (environment) using subscenes.\nThe additive system loads scene additively depending on zone & region and upon scenario load/unload requests. Each region or scenario can have dependency that will remain loaded until either a region or a scenario became irrelevant.",
|
|
6
6
|
"unity": "2021.3",
|