I am building a custom inspector for a component, and using serialized object and properties. I noticed that, because I am extending the Editor in my class, I can not access the “enabled” flag of my target game object. i.e.
using UnityEngine;
using UnityEditor;
[CustomEditor (typeof(FliesSystem))]
public class FliesSystemEditor : Editor {
private SerializedObject instance;
public void OnEnable()
{
if(instance == null) instance = new SerializedObject(target);
}
public override void OnInspectorGUI()
{
if (GUILayout.Button ("Pause",EditorStyles.miniButtonMid)) {
//instance.targetObject.enabled =true/false; I can't even cast the instance as GameObject.
}
instance.ApplyModifiedProperties();
}
}
Any Ideas?