Skip to content
This repository was archived by the owner on May 9, 2025. It is now read-only.

Commit 15d6363

Browse files
Removed ability to inspect sets in-editor
1 parent e6c1a6c commit 15d6363

File tree

1 file changed

+2
-46
lines changed

1 file changed

+2
-46
lines changed

Assets/SO Architecture/Editor/Inspectors/RuntimeSetEditor.cs

Lines changed: 2 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -8,55 +8,11 @@ public class RuntimeSetEditor : Editor
88
{
99
private SOArchitectureBaseObject Target { get { return (SOArchitectureBaseObject)target; } }
1010
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+
2412
public override void OnInspectorGUI()
2513
{
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);
2715

2816
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();
6117
}
6218
}

0 commit comments

Comments
 (0)