void RunEvent( System.Action<T> action )

robot_2Generated
code_blocksInput

Description

The RunEvent method in the Scene class is used to execute a specified action on all components within the scene. This method is particularly useful for broadcasting events or performing operations that need to affect multiple components simultaneously.

Usage

To use the RunEvent method, you need to provide a delegate of type System.Action<T> where T is the type of component you want to target. The method will iterate over all components of the specified type and execute the provided action on each one.

Example

// Example usage of Scene.RunEvent
Scene currentScene = new Scene();

// Define an action to perform on each component
System.Action<MyComponent> myAction = (component) => {
    component.DoSomething();
};

// Run the action on all components of type MyComponent
currentScene.RunEvent(myAction);