Hi all,
I want to hide these fields in the inspector and if I need to change them I want to show them with an arrow button or something like that. How can I do it?
Look up custom editor/inspectors.
the code below works fine with an integer field.
Can you tell me how can I turn it to hide the field " Material myMaterial; " or GameObject MyObject
public class MyScript : MonoBehaviour
{
public bool flag;
public int i = 1;
}
[CustomEditor(typeof(MyScript))]
public class MyScriptEditor : Editor
{
void OnInspectorGUI()
{
var myScript = target as MyScript;
myScript.flag = GUILayout.Toggle(myScript.flag, "Flag");
if(myScript.flag)
myScript.i = EditorGUILayout.IntSlider("I field:", myScript.i , 1 , 100);
}
}
up
up