@@ -8,55 +8,11 @@ public class RuntimeSetEditor : Editor
8
8
{
9
9
private SOArchitectureBaseObject Target { get { return ( SOArchitectureBaseObject ) target ; } }
10
10
private SerializedProperty DeveloperDescription { get { return serializedObject . FindProperty ( "DeveloperDescription" ) ; } }
11
-
12
- private ReorderableList _reorderableList ;
13
- private System . Type _targetType ;
14
-
15
- private void OnEnable ( )
16
- {
17
- SerializedProperty items = serializedObject . FindProperty ( "_items" ) ;
18
-
19
- _targetType = Target . GetType ( ) . BaseType . GetGenericArguments ( ) [ 0 ] ;
20
-
21
- _reorderableList = new ReorderableList ( serializedObject , items ) ;
22
- _reorderableList . drawElementCallback += DrawElement ;
23
- }
11
+
24
12
public override void OnInspectorGUI ( )
25
13
{
26
- _reorderableList . DoLayoutList ( ) ;
14
+ //EditorGUILayout.HelpBox("Cannot inspect sets. They're meant to contain runtime-data only, and assets cannot have those assigned through the editor", MessageType.Info );
27
15
28
16
EditorGUILayout . PropertyField ( DeveloperDescription ) ;
29
-
30
- _reorderableList . serializedProperty . serializedObject . ApplyModifiedProperties ( ) ;
31
- }
32
- private void DrawElement ( Rect rect , int index , bool isActive , bool isFocused )
33
- {
34
- rect . height = EditorGUIUtility . singleLineHeight ;
35
- rect . y ++ ;
36
-
37
- SerializedProperty property = _reorderableList . serializedProperty . GetArrayElementAtIndex ( index ) ;
38
-
39
- //We differentiate between the two so we can show scene objects that are assigned during runtime
40
- //Assets cannot contain scene objects, so we disallow assigning out of runtime
41
- //Note that scene objects must be assigned through code. Due to the above statement, the Unity editor specifically disallows it
42
-
43
- if ( Application . isPlaying )
44
- {
45
- //Very important not to assign to property here. Due to the comments made above, doing so will make all scene object entries null
46
- Object obj = EditorGUI . ObjectField ( rect , "Element " + index , property . objectReferenceValue , _targetType , false ) ;
47
-
48
- //If the object is a scene object we do nothing. This allows scene objects assigned through code to be visible in the editor,
49
- // while still allowing designers to manually assign non-scene objects
50
- if ( EditorUtility . IsPersistent ( obj ) )
51
- {
52
- property . objectReferenceValue = obj ;
53
- }
54
- }
55
- else
56
- {
57
- EditorGUI . PropertyField ( rect , property ) ;
58
- }
59
-
60
- property . serializedObject . ApplyModifiedProperties ( ) ;
61
17
}
62
18
}
0 commit comments