I have a script attached to a gameObject. Whenever I press play it Start() function gets called, but when pressing play again to stop play mode, it’s called again. I use a custom inspector and a custom property drawer on it and one of its fields. The call stack just shows Start() being called by the engine and not any manual call from any script.
Is this common behaviour in some way, because I don’t get it.
This makes no sense. “CanEditMultipleObjects” is an editor attribute an is only used on editor classes. Specifically on custom inspectors. The “UI.Text” class is a component and as such a runtime class.
Why do you actually want to derive your class from Text? In most cases you don’t want to do that. You usually write component behaviour scripts which use UI components.
edit
btw: The reason why Start is called when you enter playmode and when you leave it is the ExecuteInEditMode attribute which is atttached to one of the base classes of Text. Specifically to the “Graphic” class. The hierarchy is:
Text -> MaskableGraphic -> Graphic -> UIBehaviour -> MonoBehaviour -> Behaviour -> Component
/|\
|
This has [ExecuteInEditMode]