The OnGenericEvent
property is an event handler that is triggered when a generic event occurs within the SceneModel
. This property allows you to assign a callback function that will be executed whenever a generic event is fired.
The OnGenericEvent
property is an event handler that is triggered when a generic event occurs within the SceneModel
. This property allows you to assign a callback function that will be executed whenever a generic event is fired.
To use the OnGenericEvent
property, assign a method that matches the System.Action<Sandbox.SceneModel.GenericEvent>
delegate signature. This method will be called with a GenericEvent
parameter whenever the event is triggered.
// Example of subscribing to the OnGenericEvent SceneModel mySceneModel = new SceneModel(); // Define the event handler void HandleGenericEvent(SceneModel.GenericEvent evt) { // Handle the event // evt contains information about the event // For example, you can access evt.Name or evt.Data Console.WriteLine($"Generic event occurred: {evt.Name}"); } // Subscribe to the event mySceneModel.OnGenericEvent += HandleGenericEvent; // Later, when a generic event is triggered, HandleGenericEvent will be called.