Description
The NotNetworked
field is a member of the ComponentFlags
enumeration in the Sandbox API. It is used to specify that a component should remain local and not be networked as part of the scene snapshot. This flag is useful when you want to ensure that certain components are not synchronized across the network, keeping them exclusive to the local instance of the game.
Usage
Use the NotNetworked
flag when you want to prevent a component from being included in the networked scene snapshot. This is particularly useful for components that manage local-only data or behavior that should not be shared with other clients in a multiplayer environment.
To apply this flag, you can combine it with other ComponentFlags
using bitwise operations, as ComponentFlags
is marked with the FlagsAttribute
, allowing for a combination of multiple flags.
Example
// Example of using the NotNetworked flag
public class MyComponent : Component
{
public MyComponent()
{
// Set the component flags to NotNetworked
this.Flags = ComponentFlags.NotNetworked;
}
}