Question by
Lonsomehell · Jan 11, 2016 at 03:40 PM ·
editormonobehaviourcompiling
When does unity find MonoBehaviors and can I change how unity does it?
When does unity find MonoBehaviors and can I change how unity does it? I am thinking to allow the use of Annotations instead of inheriting a class can it be done ?
Comment
Why would you want to do such a thing? Could you explain what you're trying to achieve here?
Answer by AjZecrom · May 30, 2018 at 09:41 PM
Sorry for being late. Unfortunately, Monobehavior is a class, and cannot be an attribute. Only Monobehaviors are allowed to be attached to GameObjects, and the reason for this is that Unity must call a predefined API. The only reasonable way to do this is to make Monobehavior a class. Sorry for the rather bad explanation, ask me for details I missed.