I have a script that starts an animation on the enable event of the entity, but when I enable the entity the first time, the event doesn’t trigger.
If then I disable it and enable it again, the animation starts.
Doing a bit of debug, the initialize method is called as soon as I enable the entity the first time, I subscribe to the ‘enable’ event, but the event doesn’t trigger.
Thanks, I’ll keep it in mind but I found it a bit confusing as I would expect the initialize method to be executed regardless if the entity is disabled or not.
It’s like a cunstructor for me.
Also the fact the the enable event must be called manually the first time loses the idea of a auto-calling event. Expecially if the entity starts disabled, and enabling it doesn’t trigger the event.
Actually I was thinking more about the initialize method, and it’s correct that is called only if the entity is enabled.
But still, I think that the enable event should be called as soon as the entity comes to life (enabled by the system after loading a scene, or enabled by code if it is created disabled)