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.
@@ -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
- idProperty.stringValue = EditorGUI.TextField(fieldRect, idProperty.stringValue);
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
- idProperty.stringValue = System.Guid.NewGuid().ToString();
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
  }
@@ -13,7 +13,7 @@ MonoBehaviour:
13
13
  m_Name: Zone_01
14
14
  m_EditorClassIdentifier:
15
15
  id:
16
- id: dfcdf12b-b1e7-4bb0-9cc9-31e3217f483d
16
+ id: bfa98e5d-a7ac-42d1-9d9a-722030c903c9
17
17
  zoneName: 1
18
18
  zoneNb: 1
19
19
  zoneType: 0
@@ -13,7 +13,7 @@ MonoBehaviour:
13
13
  m_Name: Zone_02
14
14
  m_EditorClassIdentifier:
15
15
  id:
16
- id: eb8d1349-7a26-48ae-9c12-96947b9bf237
16
+ id: 826d580e-43cb-464a-800c-1b57cbe2df57
17
17
  zoneName: 2
18
18
  zoneNb: 2
19
19
  zoneType: 0
@@ -13,7 +13,7 @@ MonoBehaviour:
13
13
  m_Name: Zone_03
14
14
  m_EditorClassIdentifier:
15
15
  id:
16
- id: 1b96e3e9-8f70-4239-9917-9ff492516f35
16
+ id: 8199f1e4-3e80-4070-af06-e5edf91f5c0e
17
17
  zoneName: 3
18
18
  zoneNb: 3
19
19
  zoneType: 0
@@ -13,7 +13,7 @@ MonoBehaviour:
13
13
  m_Name: Zone_04
14
14
  m_EditorClassIdentifier:
15
15
  id:
16
- id: b99b2c20-3b59-4374-9cbe-41ad123bc3e1
16
+ id: 166f40b1-2c5b-4352-a59d-5f44b679a1d9
17
17
  zoneName: 4
18
18
  zoneNb: 4
19
19
  zoneType: 0
@@ -13,7 +13,7 @@ MonoBehaviour:
13
13
  m_Name: Zone_05
14
14
  m_EditorClassIdentifier:
15
15
  id:
16
- id: e605efcf-664d-48af-81e6-76d41c90f634
16
+ id: dd79d0b0-579b-4f9c-96ae-dab4e9b4ab16
17
17
  zoneName: 5
18
18
  zoneNb: 5
19
19
  zoneType: 0
@@ -13,7 +13,7 @@ MonoBehaviour:
13
13
  m_Name: Zone_06
14
14
  m_EditorClassIdentifier:
15
15
  id:
16
- id: fc255277-0978-4c49-95a0-2c369fdffe21
16
+ id: 26ad823c-62b1-4cf7-975e-71818f8ea8f3
17
17
  zoneName: 6
18
18
  zoneNb: 6
19
19
  zoneType: 0
@@ -13,7 +13,7 @@ MonoBehaviour:
13
13
  m_Name: Zone_07
14
14
  m_EditorClassIdentifier:
15
15
  id:
16
- id: 7ded9e1e-53ae-449d-9659-4f6754151c8c
16
+ id: 0354b9b9-bc2e-4cfe-b8b6-9e0f2a79e386
17
17
  zoneName: 7
18
18
  zoneNb: 7
19
19
  zoneType: 0
@@ -13,7 +13,7 @@ MonoBehaviour:
13
13
  m_Name: Zone_08
14
14
  m_EditorClassIdentifier:
15
15
  id:
16
- id: 9f9ed511-f324-428c-9951-ca6512b2dd73
16
+ id: 1154242a-6e6b-470a-ba62-a45c12e159e9
17
17
  zoneName: 8
18
18
  zoneNb: 8
19
19
  zoneType: 0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fr.jeanf.scenemanagement",
3
- "version": "0.3.4",
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",