Description
The Count
property of the SelectionSystem
class provides the number of items currently selected within the system. This property is useful for determining the size of the selection and can be used to iterate over the selected items or to perform operations based on the number of selected items.
Usage
To access the Count
property, you need to have an instance of the SelectionSystem
class. You can then retrieve the number of selected items by simply accessing this property.
Example
// Example of using the Count property
// Assume selectionSystem is an instance of SelectionSystem
SelectionSystem selectionSystem = new SelectionSystem();
// Add some items to the selection
selectionSystem.Add(new GameObject());
selectionSystem.Add(new GameObject());
// Retrieve the count of selected items
int selectedCount = selectionSystem.Count;
// Output the count
// Note: Avoid using Console.WriteLine in Sandbox
// Instead, use a UI element or logging system to display the count
// Example: Log.Info($"Number of selected items: {selectedCount}");