- Home /
Question by
Nexgea · Jul 17, 2017 at 05:06 PM ·
non-monobehavior
Is it possible to assign variables in non monobehaviour classes in inspector?
Hello,
How to make a var visible in inspector in non monobehaviour class?
Thanks
class1.png
(19.6 kB)
Comment
Best Answer
Answer by tanoshimi · Jul 17, 2017 at 05:14 PM
No, you can't. The Unity inspector allows you to inspect and assign values to components attached to Gameobjects in the scene. These, by definition, must derive from Monobehaviour.
Answer by GRASBOCK · May 09, 2020 at 08:38 AM
You can use something like [Serializable]
above the class name and [SerializeField]
above private variables that you woud want to edit in the inspector. Note however, that it does not call getters and setters
Your answer
![](https://koobas.hobune.stream/wayback/20220612130503im_/https://answers.unity.com/themes/thub/images/avi.jpg)