Description
The Count
property of the GameObjectDirectory
class provides the total number of registered game objects and components within the directory. This property is useful for quickly determining the size of the directory, which can be helpful for debugging, performance monitoring, or iterating over the collection of game objects and components.
Usage
To access the Count
property, you need an instance of the GameObjectDirectory
class. The property is read-only and returns an integer representing the total count of game objects and components.
Example
// Assuming you have an instance of GameObjectDirectory
GameObjectDirectory directory = new GameObjectDirectory();
// Get the total count of game objects and components
int totalCount = directory.Count;
// Output the count
// Note: Avoid using Console.WriteLine in Sandbox environment
// Use appropriate logging or UI display methods instead
Log.Info($"Total GameObjects and Components: {totalCount}");