- Home /
exclude public field from inspector
I'm writing custom inspector code. Basically, I'd like the automatic inspector code to take care of most of the public fields in the monobehavior. Which I can generally do by calling Editor.DrawDefaultInspector() from within the OnInspectorGUI method. Then, afterword, I am able to create my own inspector gui using the methods in EditorGUILayout. Which is great.
I want to override a particular field's inspector gui and draw a substitute gui. It serializes fine. I don't want to make it private. It should be public. Is there a way to tell the DrawDefaultInspector() method to exclude a particular field so I am free to draw it's GUI myself? An attribute perhaps? Or am I stuck having to draw every field of a behavior myself should I want to customize a single one?
Answer by Loius · Oct 16, 2010 at 07:26 PM
@HideInInspector works in Unityscript a la
@HideInInspector
var youCantSeeThis : float;
Not sure how that needs to change for C#, might be nothing or just adding the square brackets around it.
Answer by Rafes · Aug 18, 2011 at 02:46 AM
In C# it is:
 [HideInInspector]
 public float myfield = 0;  // or whatever your field/variable is.
Your answer
 
 
             Follow this Question
Related Questions
How to assign a field within a PropertyDrawer? 1 Answer
Problem with MaskField ints 1 Answer
How to record hideFlags for Undo/Redo 0 Answers
 koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                