System.Action<System.Object> OnItemAdded { get; set; }

book_4_sparkGenerated
code_blocksInput

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, you need to assign a method that matches the Action<Object> delegate signature. This method will be invoked whenever an item is added to the selection system.

For example, you can use a lambda expression or a method group to handle the event:

SelectionSystem selectionSystem = new SelectionSystem();
selectionSystem.OnItemAdded = item => {
    // Handle the item added event
    Console.WriteLine($"Item added: {item}");
};

Example

SelectionSystem selectionSystem = new SelectionSystem();

// Assign a lambda expression to handle the OnItemAdded event
selectionSystem.OnItemAdded = item => {
    // Perform actions when an item is added
    Console.WriteLine($"Item added: {item}");
};

// Add an item to trigger the event
selectionSystem.Add(new GameObject());