[SOLVED] Is there an event that we could fire when an entity is enabled?

The requirement is similar to as the OnEnable callback in UNITY3D.

Hi @yash_mehrotra,

No there isn’t an event like that. The only event an entity fires on its own is the destroy event:

https://developer.playcanvas.com/api/pc.Entity.html#event:destroy

To get the functionality you are looking for you will have to add a script to your entity and add a custom entity event of yours.

You can listen for when the script is enabled/disabled though (which is fired when the Entity is disabled/enabled) https://developer.playcanvas.com/api/pc.ScriptType.html#event:state

@yaustar

it works well, thank you.