- Home /
Is a PropertyDrawer "persistent" ?
Hi there !
My question is quite simple. I was looking at PropertyDrawer's documentation and was wondering : is a property drawer persistent ? Does it live as long as its associated Editor lives ? Or is it rebuilt on every single PropertyField call for given type ?
Thanks in advance for your answers !
Answer by yoyo · Sep 04, 2013 at 05:53 AM
It is at least somewhat persistent, as one instance of a property drawer will be reused for multiple instances of the property type that it handles. You can check this by adding member variables to your PropertyDrawer and noting that they are the same for different properties.
If you right-click (in MonoDevelop) on a reference to PropertyDrawer in your code and "Go to declaration" you can see the decompiled implementation of PropertyDrawer, which shows that it has a bunch of static members used to keep track of which property drawers are active -- suggesting that the PropertyDrawer instances persist for the duration of the editor session.
Your answer
![](https://koobas.hobune.stream/wayback/20220613111518im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Call a function from CustomPropertyDrawer of Arbitrary class 1 Answer
PropertyDrawer not painted when scrolling upwards 0 Answers
Statefull PropertyDrawer 0 Answers
Intractable CustomPropertyDrawer 0 Answers
PropertyDrawer let's dissapear my INT 0 Answers