Description
The OnItemAdded
property in the SelectionSystem
class is an event handler that is triggered whenever an item is added to the selection system. It is a public instance property of type System.Action<System.Object>
, allowing you to assign a delegate that will be called with the added item as its parameter.
Usage
To use the OnItemAdded
property, assign a method that matches the Action<Object>
delegate signature. This method will be invoked whenever an item is added to the selection system.
Example usage:
SelectionSystem selectionSystem = new SelectionSystem();
selectionSystem.OnItemAdded = item => {
// Handle the item added event
Console.WriteLine($"Item added: {item}");
};
// Add an item to trigger the event
selectionSystem.Add(new GameObject());
Example
SelectionSystem selectionSystem = new SelectionSystem();
selectionSystem.OnItemAdded = item => {
// Handle the item added event
Console.WriteLine($"Item added: {item}");
};
// Add an item to trigger the event
selectionSystem.Add(new GameObject());