- Home /
[SerializeField] makes fields visible and editable in the inspector
I would like to make some private fields in my component serializable, however if I use the [SerializeField] attribute it also makes them visible and editiable in the inspector.
I guess could I could make a custom property drawer that displays nothing?
Is there a handier way of achieving what I want? (have a field in my component be serialzed but not be visible in the inspector)
Answer by Chris_Dlala · Aug 24, 2014 at 09:29 PM
Hi, add [HideInInspector] attribute as well (link):
[SerializeField][HideInInspector] private int width;
I hope that helps =D
Your answer
Follow this Question
Related Questions
Select a type from the inspector 0 Answers
Customizing Inspector variables. 2 Answers
Using [SerializeField] vs public 2 Answers
Loading sprite by script shows weird icon 0 Answers
Serialize Custom Abstract Class (No-MonoBehaviour / No-ScriptableObject) 1 Answer