Hi all. I'm trying to add a popup_list to a custom editor of my new component to initialize data. I've managed to do it with a new Editor class : Code (CSharp): public class myscript : MonoBehaviour { public bool toto ... void Start() { if (toto) { DoSomething; } else { DoSomethingElse; } } ... } [CustomEditor(typeof(myscript))] public class myscriptEditor : Editor { public enum OPTIONS { PARAM_INI_1= 0, PARAM_INI_2= 1, } public OPTIONS op; bool Type_CI; public override void OnInspectorGUI() { DrawDefaultInspector(); myscript myScript = (myscript)target; op = (OPTIONS)EditorGUILayout.EnumPopup("Type of Initial Conditions:", op); Type_CI = InstantiatePrimitive(op); if (Type_CI) { myScript.toto = true; } else { myScript.toto = false; } } bool InstantiatePrimitive(OPTIONS op) { switch (op) { case OPTIONS.PARAM_INI_1: return true; break; case OPTIONS.PARAM_INI_2: return false; break; default: Debug.LogError("Unrecognized Option"); return false; break; } } } The popup list works fine but the property named "toto" is also visible in the editor. I'd like to hide it as it an internal property. If I change it to private I can't modifiy it with my Editor class. Thks for your help
Try this https://docs.unity3d.com/ScriptReference/HideInInspector.html Alternatively use a property as they are not serialised.