Description
The EditorOnly
field is a member of the GameObjectFlags
enumeration in the Sandbox API. It is used to mark game objects that should only exist within the editor environment and not be instantiated or used during gameplay. This flag is particularly useful for objects that are meant for design-time purposes, such as guides or markers that assist in level design but are not needed in the final game.
Usage
Use the EditorOnly
flag when you want to ensure that a game object is only present in the editor and not included in the game build. This can help reduce unnecessary objects in the game environment, improving performance and maintaining a clean game state.
To apply this flag, set it on a game object like so:
Example
```csharp
GameObject myEditorObject = new GameObject();
myEditorObject.Flags |= GameObjectFlags.EditorOnly;
```