Description
The Flags
property of a Component
in the Sandbox API is used to store and manage various flags that define the behavior or state of the component. These flags are represented by the ComponentFlags
enumeration, which can include various predefined flags that affect how the component interacts with the game engine or other components.
Usage
To use the Flags
property, you can get or set the flags for a component to modify its behavior. This property is not static, so it must be accessed through an instance of a Component
.
Example
// Example of setting and getting the Flags property of a Component
// Assume 'component' is an instance of a Component
component.Flags = ComponentFlags.SomeFlag | ComponentFlags.AnotherFlag;
// Check if a specific flag is set
bool isFlagSet = (component.Flags & ComponentFlags.SomeFlag) != 0;
// Output the current flags
var currentFlags = component.Flags;