Ejemplo n.º 1
0
        public override void OnInspectorGUI()
        {
            serializedObject.Update();

            EditorGUILayout.PropertyField(CompProp);
            var guiColor = GUI.color;

            var names = Props.Select(x => x.Name).ToList();
            var ids   = Props.Select(x => x.Id).ToList();

            var index = ids.IndexOf(PropertyId.stringValue);

            if (index < 0)
            {
                names.Insert(0, "UNDEFINED");
                ids.Insert(0, Guid.Empty.ToString());
                index     = 0;
                GUI.color = Color.yellow;
            }

            var selectedIndex = EditorGUILayout.Popup(PropsLabel, index, names.ToArray());

            if (selectedIndex != index)
            {
                PropertyId.stringValue = ids[selectedIndex];
            }

            GUI.color = guiColor;
            PointerOverriderEditor.DrawGUI(Props, names[selectedIndex]);

            serializedObject.ApplyModifiedProperties();
        }
Ejemplo n.º 2
0
 protected void OnEnable()
 {
     CompProp               = serializedObject.FindProperty("_comp");
     PropertyId             = serializedObject.FindProperty("_propertyId");
     PointerOverriderEditor = new PointerOverriderEditor(serializedObject);
 }