The Components
property provides access to the list of components attached to the GameObject
that this Component
is part of. This property is sealed, meaning it cannot be overridden in derived classes.
The Components
property provides access to the list of components attached to the GameObject
that this Component
is part of. This property is sealed, meaning it cannot be overridden in derived classes.
Use the Components
property to iterate over or manipulate the components attached to the same GameObject
as the current component. This can be useful for accessing other components to modify their properties or call their methods.
// Example of accessing the Components property public class ExampleComponent : Component { public void PrintComponentNames() { foreach (var component in Components) { Log.Info(component.GetType().Name); } } }