Description
The Id
property of a Component
in the Sandbox framework is a unique identifier of type System.Guid
. This identifier is used to uniquely distinguish each component instance within the game environment. It is automatically assigned and managed by the system, ensuring that each component can be individually referenced and tracked.
Usage
Use the Id
property when you need to uniquely identify a component, for example, when storing references to components or when performing operations that require a specific component instance. The Id
is read-only and is automatically set by the system, so you do not need to manually assign it.
Example
// Example of accessing the Id property of a component
Component myComponent = new MyCustomComponent();
System.Guid componentId = myComponent.Id;
// Use the Id to log or store the component reference
Log.Info($"Component ID: {componentId}");