Question by
eiked · Aug 05, 2016 at 12:47 PM ·
datacomponentsdesign-patterns
Extending Behaviour instead of Monobehaviour
I noticed that a script Component can extend the Behaviour class instead of the MonoBehaviour (extending the Component class doesn't seem to work).
The Behaviour class is missing the bells and whistles like "Update", "Start", "Awake" etc. methods that get called.
However, for a component that represents only data, wouldn't it be more appropriate then to extend the Behaviour class? Are there any downsides or would it be actually useful to "tag" objects with data, given that they won't have to act on their own? Or is a MonoBehaviour script already optimizing this away anyway?
Comment
I have found out that UnityEvents can't interface with methods in Behaviour derived classes... that's one obvious drawback.