Archive 17/01/2023.

Custom components and events

sabotage3d

Hi guys ,
Is there a simple example on how to create custom components and events in C++ .
For example if I am to send an event “hit” to a group of objects changing their color to red for a few seconds.

jmiller

One example of a custom event:
topic660.html#p3610

Sample 13_Ragdolls has a custom component:
github.com/urho3d/Urho3D/blob/m … eRagdoll.h
github.com/urho3d/Urho3D/blob/m … agdoll.cpp

Your component’s OnNodeSet() can subscribe to your custom event, etc.

Remember to register your component before trying to instantiate it :mrgreen:

That sample does it in the Application’s constructor:
context->RegisterFactory();

sabotage3d

Thanks but I was thinking for a simpler example that shows the combination of components and events .