### Example RPC Consume System Source: https://docs.unity3d.com/Packages/com.unity.netcode%401.10/api/Unity.NetCode.RpcExecutor.html An example system demonstrating how to consume RPCs created by RpcExecutor. It queries for RPCs with a ReceiveRpcCommandRequestComponent and processes them before destroying the entities. ```csharp public struct MyRpcConsumeSystem : ISystem { private Query rcpQuery; public void OnCreate(ref SystemState state) { var builder = new EntityQueryBuilder(Allocator.Temp).WithAll(); rcpQuery = state.GetEntityQuery(builder); } public void OnUpdate(ref SystemState state) { foreach(var rpc in SystemAPI.Query().WithAll()) { //do something with the rpc } //Consumes all of them state.EntityManager.DestroyEntity(rpcQuery); } } ``` -------------------------------- ### Get Singleton and Create Command Buffer Source: https://docs.unity3d.com/Packages/com.unity.netcode%401.10/api/Unity.NetCode.BeginPredictedSimulationEntityCommandBufferSystem.Singleton.html Use SystemAPI.GetSingleton to retrieve the singleton component. Then, call CreateCommandBuffer on the singleton to get an EntityCommandBuffer for recording commands. ```csharp var ecbSingleton = SystemAPI.GetSingleton(); var commandBuffer = ecbSingleton.CreateCommandBuffer(world); ``` -------------------------------- ### Create and Listen with NetworkStreamDriver Source: https://docs.unity3d.com/Packages/com.unity.netcode%401.10/api/Unity.NetCode.NetworkStreamDriver.html Demonstrates how to create a server driver, reset its store, and start listening on a specific port. ```csharp var driverStore = new NetworkDriverStore(); var constructor = NetworkStreamReceiveSystem.DriverConstructor; constructor.CreateServerDriver(serverWorld, ref driverStore, netDebug); var driver = EntityManager.CreateEntityQuery(typeof(NetworkStreamDriver)).GetSingleton(); driver.ResetDriverStore(driverStore); var listenEndPoint = NetworkEndpoint.AnyIpv4.WithPort(MyPort); driver.Listen(listenEndPoint); ``` -------------------------------- ### OnStartRunning Method Source: https://docs.unity3d.com/Packages/com.unity.netcode%401.10/api/Unity.NetCode.GhostDistancePartitioningSystem.html Called when the system starts or resumes updating. Use this to prepare for updates after a stop or disable. ```csharp [BurstCompile] public void OnStartRunning(ref SystemState state) ``` -------------------------------- ### Custom Client Server Bootstrap Configuration Source: https://docs.unity3d.com/Packages/com.unity.netcode%401.10/api/Unity.NetCode.ClientServerTickRate.html Example of how to create a custom ClientServerBootstrap to initialize the ClientServerTickRate singleton with a specific simulation tick rate (30Hz) on the server. ```csharp class MyCustomClientServerBootstrap : ClientServerBootstrap { override public void Initialize(string defaultWorld) { base.Initialise(defaultWorld); var customTickRate = new ClientServerTickRate(); //run at 30hz customTickRate.simulationTickRate = 30; customTickRate.ResolveDefault(); foreach(var world in World.All) { if(world.IsServer()) { //In this case we only create on the server, but we can do the same also for the client world var tickRateEntity = world.EntityManager.CreateSingleton(new ClientServerTickRate { SimulationTickRate = 30; }); } } } } ``` -------------------------------- ### Send RPC Command Request Example Source: https://docs.unity3d.com/Packages/com.unity.netcode%401.10/api/Unity.NetCode.html Example of using RpcCommandRequest.SendRpcData within a Burst compiled job to handle RPC command requests. Ensure to use InitJobData(ref SystemState) for valid construction. ```csharp [BurstCompile] struct SendRpc : IJobChunk { public RpcCommandRequest{MyRpcCommand, MyRpcCommand}.SendRpcData data; public void Execute(in ArchetypeChunk chunk, int unfilteredChunkIndex, bool useEnabledMask, in v128 chunkEnabledMask) { data.Execute(chunk, unfilteredChunkIndex); } } ``` -------------------------------- ### OnStartRunning Method for WarnAboutApplicationRunInBackground Source: https://docs.unity3d.com/Packages/com.unity.netcode%401.10/api/Unity.NetCode.WarnAboutApplicationRunInBackground.html The OnStartRunning method is called when the system starts running. It resets the warning as the client has disconnected. ```csharp public void OnStartRunning(ref SystemState state) { } ``` -------------------------------- ### OnCreate Method for CopyInputToCommandBufferSystem Source: https://docs.unity3d.com/Packages/com.unity.netcode%401.10/api/Unity.NetCode.CopyInputToCommandBufferSystem-2.html The OnCreate method is called when the system is created, allowing for setup of system resources before the first update. ```csharp public void OnCreate(ref SystemState state) ``` -------------------------------- ### RpcCommandRequest Methods Source: https://docs.unity3d.com/Packages/com.unity.netcode%401.10/api/Unity.NetCode.RpcCommandRequest-2.html Documentation for the methods available on the RpcCommandRequest struct, including initialization and job data setup. ```APIDOC ## InitJobData(ref SystemState) ### Description Initialize the internal state of a processing job. Should be called from OnUpdate of an ISystem. ### Method `public RpcCommandRequest.SendRpcData InitJobData(ref SystemState state)` ### Parameters #### Parameters - **state** (SystemState) - Raw entity system state. ### Returns - **RpcCommandRequest.SendRpcData** - RpcCommandRequest.SendRpcData initialized using `state` ## OnCreate(ref SystemState) ### Description Initialize the helper struct, should be called from OnCreate in an ISystem. ### Method `public void OnCreate(ref SystemState state)` ### Parameters #### Parameters - **state** (SystemState) - Unity.Entities.SystemState ``` -------------------------------- ### Listen Source: https://docs.unity3d.com/Packages/com.unity.netcode%401.10/api/Unity.NetCode.NetworkStreamDriver.html Configures all registered NetworkDriverStore drivers to start listening for incoming connections on the specified local address. ```APIDOC ## Listen ### Description Tell all the registered NetworkDriverStore drivers to start listening for incoming connections. ### Method public bool Listen(NetworkEndpoint endpoint) ### Parameters #### Path Parameters - **endpoint** (NetworkEndpoint) - The local address to use. This is the address that will be used to bind the underlying socket. ### Returns - **bool** - Whether the drivers starts listening ``` -------------------------------- ### Start listening for incoming connections Source: https://docs.unity3d.com/Packages/com.unity.netcode%401.10/api/Unity.NetCode.NetworkStreamDriver.html Instructs all registered NetworkDriverStore drivers to begin listening for incoming connections on the specified local address. ```csharp public bool Listen(NetworkEndpoint endpoint) ``` -------------------------------- ### Example Struct Implementing IRpcCommandSerializer Source: https://docs.unity3d.com/Packages/com.unity.netcode%401.10/api/Unity.NetCode.IRpcCommandSerializer-1.html Demonstrates a common pattern where a struct implementing IComponentData also implements IRpcCommandSerializer for custom serialization and deserialization logic. ```csharp struct MyRpc : IComponentData, IRpcCommandSerializer{MyRpc} { public void Serialize(ref DataStreamWriter writer, in RpcSerializerState state, in MyRpc data) { ... } public void Deserialize(ref DataStreamReader reader, in RpcDeserializerState state, ref MyRpc data) { ... } PortableFunctionPointer{RpcExecutor.ExecuteDelegate} CompileExecute() { ... } } ``` -------------------------------- ### Get Timestamp in Milliseconds Source: https://docs.unity3d.com/Packages/com.unity.netcode%401.10/api/Unity.NetCode.NetworkTimeSystem.html Retrieves a low-precision, real-time timestamp in milliseconds since the process started. This is primarily used for calculating Round Trip Time (RTT) for network synchronization. ```csharp public static uint TimestampMS { get; } ``` -------------------------------- ### OnCreate Method Source: https://docs.unity3d.com/Packages/com.unity.netcode%401.10/api/Unity.NetCode.GhostDistancePartitioningSystem.html Initializes the GhostDistancePartitioningSystem. Implement this to set up system resources before the first update. ```csharp [BurstCompile] public void OnCreate(ref SystemState state) ``` -------------------------------- ### Reset Entity Start Bits Source: https://docs.unity3d.com/Packages/com.unity.netcode%401.10/api/Unity.NetCode.LowLevel.Unsafe.GhostComponentSerializer.html Internal use only, primarily for code generation. Resets the recorded start and end positions for entities within a compressed bit stream. Requires a DataStreamWriter and a pointer to entity start bit data. ```csharp public static void ResetEntityStartBits(int count, ref DataStreamWriter writer, IntPtr entityStartBit) ``` -------------------------------- ### OnCreate Method for PrespawnedGhostPreprocessScene Source: https://docs.unity3d.com/Packages/com.unity.netcode%401.10/api/Unity.NetCode.Editor.PrespawnedGhostPreprocessScene.html The OnCreate method is called when the system is created, used for setting up system resources. ```csharp [BurstCompile] public void OnCreate(ref SystemState state) { } ``` -------------------------------- ### RpcExecutor ExecuteDelegate Example Source: https://docs.unity3d.com/Packages/com.unity.netcode%401.10/api/Unity.NetCode.html Example of a static burst-compatible method signature for RpcExecutor.ExecuteDelegate. This method is invoked when an RPC is received. ```csharp [BurstCompile(DisableDirectCall = true)] [AOT.MonoPInvokeCallback(typeof(RpcExecutor.ExecuteDelegate))] private static void InvokeExecute(ref RpcExecutor.Parameters parameters) ``` -------------------------------- ### Initialize Client and Server Worlds Source: https://docs.unity3d.com/Packages/com.unity.netcode%401.10/api/Unity.NetCode.ClientServerBootstrap.html Implement the ICustomBootstrap interface to create default client and server worlds based on the RequestedPlayType. In the Editor, it also creates thin client worlds if RequestedNumThinClients is not 0. ```csharp public virtual bool Initialize(string defaultWorldName) ``` -------------------------------- ### GhostComponentVariationAttribute DisplayName Example Source: https://docs.unity3d.com/Packages/com.unity.netcode%401.10/api/Unity.NetCode.GhostComponentVariationAttribute.html Provides an example of a user-friendly, readable name for a component variant, used for UI and logging. ```csharp "Translation - 2D" ``` -------------------------------- ### NetDebugPacket Init Method Source: https://docs.unity3d.com/Packages/com.unity.netcode%401.10/api/Unity.NetCode.LowLevel.Unsafe.NetDebugPacket.html Initializes the NetDebugPacket with a log folder, world name, and connection ID. ```csharp public void Init(in FixedString512Bytes logFolder, in FixedString128Bytes worldName, int connectionId) ``` -------------------------------- ### ClientServerBootstrap Methods Source: https://docs.unity3d.com/Packages/com.unity.netcode%401.10/api/Unity.NetCode.ClientServerBootstrap.html Provides utility methods for iterating over worlds and creating new client worlds with optional system configurations. ```APIDOC ## ClientServerBootstrap Methods ### AllClientWorldsEnumerator() Helper; returns an IEnumerable iterating over all ClientWorlds, then all ThinClientWorlds. **Returns** - **IEnumerable**: An IEnumerable. ### AllNetCodeWorldsEnumerator() Helper; returns an IEnumerable iterating over all ServerWorld's, then all AllClientWorldsEnumerator() worlds (which itself iterates over all ClientWorlds, then all ThinClientWorlds). **Returns** - **IEnumerable**: An IEnumerable. ### CreateClientWorld(string name) Utility method for creating new clients worlds. Can be used in custom implementations of `Initialize`, as well as at runtime (to add new clients dynamically), or when you need to create a client programmatically (for example; frontends that allow selecting "Create Game" vs "Join Game", or similar). **Parameters** - **name** (string) - Required - The client world name. **Returns** - **World**: Client world instance. ### CreateClientWorld(string name, NativeList systems) Utility method for creating new clients worlds. Can be used in custom implementations of `Initialize`, as well as at runtime (to add new clients dynamically), or when you need to create a client programmatically (for example; frontends that allow selecting "Create Game" vs "Join Game", or similar). **Parameters** - **name** (string) - Required - The client world name. - **systems** (NativeList) - Required - List of systems to be included. **Returns** - **World**: Client world instance. ``` -------------------------------- ### Construct SimulatorPreset with Full Parameters Source: https://docs.unity3d.com/Packages/com.unity.netcode%401.10/api/Unity.NetCode.SimulatorPreset.html Use this constructor to create a new simulator preset with a name, packet delay, jitter, loss, fuzz percentage, and a tooltip. ```csharp public SimulatorPreset(string name, int packetDelayMs, int packetJitterMs, int packetLossPercent, int packetFuzzPercent, string tooltip) ``` -------------------------------- ### Example Usage of ExecuteDelegate with BurstCompile Source: https://docs.unity3d.com/Packages/com.unity.netcode%401.10/api/Unity.NetCode.RpcExecutor.ExecuteDelegate.html An example demonstrating how to implement the RpcExecutor.ExecuteDelegate with BurstCompile. The DisableDirectCall = true attribute is necessary to work around an issue with Burst and function delegates when implementing custom RPC serializers. ```csharp [BurstCompile(DisableDirectCall = true)] [AOT.MonoPInvokeCallback(typeof(RpcExecutor.ExecuteDelegate))] private static void InvokeExecute(ref RpcExecutor.Parameters parameters) ``` -------------------------------- ### RequestedSimulatorView Source: https://docs.unity3d.com/Packages/com.unity.netcode%401.10/api/Unity.NetCode.MultiplayerPlayModePreferences.html Gets or sets the preferred mode for the Simulator in the editor. ```APIDOC ## RequestedSimulatorView ### Description Editor "mode". Stores the preferred mode that the Simulator is in. ### Property - **RequestedSimulatorView** (SimulatorView) - Gets or sets the preferred simulator view. ### Property Value Type | Description ---|--- SimulatorView | ``` -------------------------------- ### DefaultBootstrapThinClientWorldInitialization Method Source: https://docs.unity3d.com/Packages/com.unity.netcode%401.10/api/Unity.NetCode.AutomaticThinClientWorldsUtility.html Default initialization for bootstrap thin clients. Injects loaded scenes' sub-scenes. Returns the newly created world or null. ```csharp public static World DefaultBootstrapThinClientWorldInitialization(World referenceWorld) ``` -------------------------------- ### PredictedPhysicsConfigSystem Source: https://docs.unity3d.com/Packages/com.unity.netcode%401.10/api/Unity.NetCode.PredictedPhysicsConfigSystem.html A system which setup physics for prediction. It will move the PhysicsSystemGroup to the PredictedFixedStepSimulationSystemGroup. ```APIDOC ## Class PredictedPhysicsConfigSystem A system which setup physics for prediction. It will move the PhysicsSystemGroup to the PredictedFixedStepSimulationSystemGroup. ### Inheritance object ComponentSystemBase SystemBase PredictedPhysicsConfigSystem ### Namespace Unity.NetCode ### Assembly Unity.NetCode.Physics.dll ``` -------------------------------- ### WarnAboveAverageBatchedTicksPerFrame Source: https://docs.unity3d.com/Packages/com.unity.netcode%401.10/api/Unity.NetCode.MultiplayerPlayModePreferences.html Gets or sets the threshold for warning about batched ticks per frame. ```APIDOC ## WarnAboveAverageBatchedTicksPerFrame ### Description If the average is above this percent a warning will be displayed. Set to 0 to always warn when ticks are batched. ### Property - **WarnAboveAverageBatchedTicksPerFrame** (float) - Gets or sets the threshold for warning about average batched ticks per frame. ### Property Value Type | Description ---|--- float | ``` -------------------------------- ### Initialize Method Source: https://docs.unity3d.com/Packages/com.unity.netcode%401.10/api/Unity.NetCode.ClientServerBootstrap.html Initializes the client and server worlds based on the requested play type. In the Editor, it can also create thin client worlds. ```APIDOC ## Initialize(string) ### Description Implement the ICustomBootstrap interface. Create the default client and server worlds based on the RequestedPlayType. In the Editor, it also creates thin client worlds, if RequestedNumThinClients is not 0. ### Declaration ```csharp public virtual bool Initialize(string defaultWorldName) ``` ### Parameters #### Path Parameters - **defaultWorldName** (string) - Required - The name to use for the default world. Unused, can be null or empty. ### Returns - **bool** - true if the bootstrap has performed initialization, or false if default world initialization should be performed. ``` -------------------------------- ### SimulateDedicatedServer Source: https://docs.unity3d.com/Packages/com.unity.netcode%401.10/api/Unity.NetCode.MultiplayerPlayModePreferences.html Gets or sets a value indicating whether to simulate a dedicated server. ```APIDOC ## SimulateDedicatedServer ### Description Gets or sets a value indicating whether to simulate a dedicated server. ### Property - **SimulateDedicatedServer** (bool) - Gets or sets a value indicating whether to simulate a dedicated server. ### Property Value Type | Description ---|--- bool | ``` -------------------------------- ### ShowAllSimulatorPresets Source: https://docs.unity3d.com/Packages/com.unity.netcode%401.10/api/Unity.NetCode.MultiplayerPlayModePreferences.html Gets or sets a value indicating whether all simulator presets should be visible. ```APIDOC ## ShowAllSimulatorPresets ### Description If true, all simulator presets will be visible, rather than only platform specific ones. ### Property - **ShowAllSimulatorPresets** (bool) - Gets or sets a value indicating whether all simulator presets should be visible. ### Property Value Type | Description ---|--- bool | ``` -------------------------------- ### ClientPopulatePrespawnedGhostsSystem OnCreate Method Source: https://docs.unity3d.com/Packages/com.unity.netcode%401.10/api/Unity.NetCode.ClientPopulatePrespawnedGhostsSystem.html The OnCreate method for ClientPopulatePrespawnedGhostsSystem, used for setting up system resources upon creation. It is called before the system begins running. ```csharp [BurstCompile] public void OnCreate(ref SystemState state) ``` -------------------------------- ### Get Requested Simulator View Source: https://docs.unity3d.com/Packages/com.unity.netcode%401.10/api/Unity.NetCode.MultiplayerPlayModePreferences.html Retrieves the preferred mode for the Simulator in the editor. ```csharp public static SimulatorView RequestedSimulatorView { get; set; } ``` -------------------------------- ### BootstrapInitialization Delegate Source: https://docs.unity3d.com/Packages/com.unity.netcode%401.10/api/Unity.NetCode.AutomaticThinClientWorldsUtility.html Allows custom initialization for thin clients during bootstrap. Defaults to DefaultBootstrapThinClientWorldInitialization. Set to null to disable. ```csharp public static AutomaticThinClientWorldsUtility.ThinClientWorldInitializationDelegate BootstrapInitialization ``` -------------------------------- ### ClientServerBootstrap Constructor Source: https://docs.unity3d.com/Packages/com.unity.netcode%401.10/api/Unity.NetCode.ClientServerBootstrap.html Initializes a new instance of the ClientServerBootstrap class, resetting static data. ```csharp public ClientServerBootstrap() ``` -------------------------------- ### WarnBatchedTicks Source: https://docs.unity3d.com/Packages/com.unity.netcode%401.10/api/Unity.NetCode.MultiplayerPlayModePreferences.html Gets or sets a value indicating whether to warn when prediction ticks are batched. ```APIDOC ## WarnBatchedTicks ### Description If true, will force NetDebugSystem to display a warning when prediction ticks are batched. ### Property - **WarnBatchedTicks** (bool) - Gets or sets a value indicating whether to warn when prediction ticks are batched. ### Property Value Type | Description ---|--- bool | ``` -------------------------------- ### TargetLogLevel Source: https://docs.unity3d.com/Packages/com.unity.netcode%401.10/api/Unity.NetCode.MultiplayerPlayModePreferences.html Gets or sets the target log level for NetDebugSystem loggers when ApplyLoggerSettings is true. ```APIDOC ## TargetLogLevel ### Description If ApplyLoggerSettings, forces all NetDebugSystem loggers to this log level. ### Property - **TargetLogLevel** (NetDebug.LogLevelType) - Gets or sets the target log level for NetDebugSystem loggers. ### Property Value Type | Description ---|--- NetDebug.LogLevelType | ``` -------------------------------- ### CreateThinClientWorld with Systems Utility Source: https://docs.unity3d.com/Packages/com.unity.netcode%401.10/api/Unity.NetCode.ClientServerBootstrap.html Creates thin client worlds with a specified list of systems. This allows for customized thin client configurations, useful for dynamic client addition at runtime or custom initialization. ```csharp public static World CreateThinClientWorld(NativeList systems) ``` -------------------------------- ### RuntimeInitialization Delegate Source: https://docs.unity3d.com/Packages/com.unity.netcode%401.10/api/Unity.NetCode.AutomaticThinClientWorldsUtility.html Allows custom initialization for thin clients at runtime. Defaults to DefaultRuntimeThinClientWorldInitialization. Set to null to disable. ```csharp public static AutomaticThinClientWorldsUtility.ThinClientWorldInitializationDelegate RuntimeInitialization ``` -------------------------------- ### TypeCast Source: https://docs.unity3d.com/Packages/com.unity.netcode%401.10/api/Unity.NetCode.LowLevel.Unsafe.GhostComponentSerializer.html Helper method to get a mutable reference to struct data from its address in memory. ```APIDOC ## TypeCast(IntPtr, int) ### Description Helper method to get a reference to a struct data from its address in memory. ### Method Signature ```csharp public static ref T TypeCast(IntPtr value, int offset = 0) where T : struct ``` ### Parameters - **value** (IntPtr) - Data. - **offset** (int) - Offset (defaults to 0). ### Returns - **T** - Reference to component type in data. ### Type Parameters - **T** - Component type. ``` -------------------------------- ### TypeCastReadonly Source: https://docs.unity3d.com/Packages/com.unity.netcode%401.10/api/Unity.NetCode.LowLevel.Unsafe.GhostComponentSerializer.html Helper method to get a read-only reference to struct data from its address in memory. ```APIDOC ## TypeCastReadonly(IntPtr, int) ### Description Helper method to get a reference to a struct data from its address in memory. ### Method Signature ```csharp public static ref readonly T TypeCastReadonly(IntPtr value, int offset = 0) where T : struct ``` ### Parameters - **value** (IntPtr) - Data. - **offset** (int) - Offset (defaults to 0). ### Returns - **T** - Reference to component type in data. ### Type Parameters - **T** - Component type. ``` -------------------------------- ### ClientServerBootstrap Source: https://docs.unity3d.com/Packages/com.unity.netcode%401.10/api/Unity.NetCode.html Base class for configuring and creating server and client worlds at runtime. It provides utility methods for world creation and automatic client-server connection setup. ```APIDOC ## Class ClientServerBootstrap ### Description ClientServerBootstrap is responsible for configuring and creating the server and client worlds at runtime when the game starts (or when entering Play Mode in the Editor). ClientServerBootstrap is intended as a base class for your own custom bootstrap code and provides utility methods for creating the client and server worlds. It also supports connecting the client to the server automatically, using the AutoConnectPort port and DefaultConnectAddress. For the server, ClientServerBootstrap allows binding the server transport to a specific listening port and address (especially useful when running the server on cloud providers) via DefaultListenAddress. ### Usage Inherit from this class to customize your game's client and server world setup. Configure connection details like `AutoConnectPort`, `DefaultConnectAddress`, and `DefaultListenAddress` as needed. ``` -------------------------------- ### BlobStringText Length Property Source: https://docs.unity3d.com/Packages/com.unity.netcode%401.10/api/Unity.NetCode.LowLevel.BlobStringText.html Gets or sets the length of the BlobStringText. Always throws NotImplementedException. ```csharp public int Length { get; set; } ``` -------------------------------- ### GhostUpdateSystem OnCreate Method Source: https://docs.unity3d.com/Packages/com.unity.netcode%401.10/api/Unity.NetCode.GhostUpdateSystem.html The OnCreate method is called when the system is created, used for setting up system resources before the first update. ```csharp public void OnCreate(ref SystemState systemState) { } ``` -------------------------------- ### Create Client World with Name and Systems Source: https://docs.unity3d.com/Packages/com.unity.netcode%401.10/api/Unity.NetCode.ClientServerBootstrap.html Utility method for creating new client worlds with a specified list of systems. Can be used in custom initializations or for programmatic creation. ```csharp public static World CreateClientWorld(string name, NativeList systems) ``` -------------------------------- ### BlobStringText Indexer Source: https://docs.unity3d.com/Packages/com.unity.netcode%401.10/api/Unity.NetCode.LowLevel.BlobStringText.html Gets or sets the element at a specific index. Always throws NotImplementedException. ```csharp public byte this[int index] { get; set; } ``` -------------------------------- ### GUID Property Source: https://docs.unity3d.com/Packages/com.unity.netcode%401.10/api/Unity.NetCode.Hybrid.NetCodeClientAndServerSettings.html This property returns the unique ID of the settings asset as a Hash128. It is read-only. ```csharp public Hash128 GUID { get; } ``` -------------------------------- ### Create Client Network Pipelines with Simulator Support Source: https://docs.unity3d.com/Packages/com.unity.netcode%401.10/api/Unity.NetCode.DefaultDriverBuilder.html Configures client network pipelines (reliable, unreliable, unreliable fragmented) with support for the network simulator. Use this only for client drivers. ```csharp public static void CreateClientSimulatorPipelines(ref NetworkDriverStore.NetworkDriverInstance driverInstance) ``` -------------------------------- ### GhostType to Hash128 Conversion Operator Source: https://docs.unity3d.com/Packages/com.unity.netcode%401.10/api/Unity.NetCode.GhostType.html Converts a GhostType to a Unity.Entities.Hash128, using the prefab GUID. ```csharp public static explicit operator Hash128(GhostType ghostType) ``` -------------------------------- ### EditorImportanceSuggestion Tooltip Field Source: https://docs.unity3d.com/Packages/com.unity.netcode%401.10/api/Unity.NetCode.Hybrid.EditorImportanceSuggestion.html Offers a single-line example or explanation for when to use this specific importance suggestion. ```csharp public string Tooltip ``` -------------------------------- ### SimulatorPreset Methods Source: https://docs.unity3d.com/Packages/com.unity.netcode%401.10/api/Unity.NetCode.SimulatorPreset.html Methods for managing and appending simulator presets. ```APIDOC ## AppendAdditionalMobileSimulatorProfiles(List) ### Description Appends best-estimate approximations for mobile connection types, informed by real-world data. ### Parameters - **list** (List) - Required - The list to append presets to. ## AppendAdditionalPCSimulatorPresets(List) ### Description Appends best-estimate approximations of PC and Console connection types, informed by real-world data. ### Parameters - **list** (List) - Required - The list to append presets to. ## AppendBaseSimulatorPresets(List) ### Description Appends the most common simulator profiles, including custom debug ones. ### Parameters - **list** (List) - Required - The list to append presets to. ## BuildProfiles(List, bool, string, int, int, int, string) ### Description Builds sub-profiles for your profile. For example, creates 4 regional options for your custom profile. ### Parameters - **list** (List) - Required - The list to append profiles to. - **showRegional** (bool) - Required - Whether to show regional options. - **name** (string) - Required - The base name for the profiles. - **packetDelayMs** (int) - Required - Packet delay in milliseconds for the profiles. - **packetJitterMs** (int) - Required - Packet jitter in milliseconds for the profiles. - **packetLossPercent** (int) - Required - Packet loss in percentage for the profiles. - **tooltip** (string) - Required - Tooltip string for the profiles. ``` -------------------------------- ### CreateServerWorld with Systems Utility Source: https://docs.unity3d.com/Packages/com.unity.netcode%401.10/api/Unity.NetCode.ClientServerBootstrap.html Creates a new server world with a specified list of systems. This provides more control over the server world's configuration, useful for custom initialization or runtime server creation. ```csharp public static World CreateServerWorld(string name, NativeList systems) ``` -------------------------------- ### GetHeaderSize Source: https://docs.unity3d.com/Packages/com.unity.netcode%401.10/api/Unity.NetCode.SnapshotDynamicBuffersHelper.html Gets the size of the header at the beginning of the dynamic snapshot buffer. The header size is constant. ```APIDOC ## GetHeaderSize() ### Description Get the size of the header at the beginning of the dynamic snapshot buffer. The size of the header is constant. ### Method static uint ### Returns - **uint** - Size of the header at the beginning of the dynamic snapshot buffer ``` -------------------------------- ### EnableClientServerBootstrap Configuration Source: https://docs.unity3d.com/Packages/com.unity.netcode%401.10/api/Unity.NetCode.NetCodeConfig.html Determines if the ClientServerBootstrap should be triggered on game boot. This is a project-wide setting that can be overridden. ```csharp [Header("NetCode")] [Tooltip("Denotes if the ClientServerBootstrap (or any derived version of it) should be triggered on game boot. Project-wide setting (when this config is applied in the Netcode tab), overridable via the OverrideAutomaticNetCodeBootstrap MonoBehaviour.")] [SerializeField] public NetCodeConfig.AutomaticBootstrapSetting EnableClientServerBootstrap ``` -------------------------------- ### WarnBatchedTicksRollingWindow Source: https://docs.unity3d.com/Packages/com.unity.netcode%401.10/api/Unity.NetCode.MultiplayerPlayModePreferences.html Gets or sets the number of frames used for calculating the rolling average of batched ticks. ```APIDOC ## WarnBatchedTicksRollingWindow ### Description Specifies the number of frames the rolling average is calculated over. ### Property - **WarnBatchedTicksRollingWindow** (int) - Gets or sets the number of frames for the rolling average calculation. ### Property Value Type | Description ---|--- int | ``` -------------------------------- ### SimulatorEnabled Source: https://docs.unity3d.com/Packages/com.unity.netcode%401.10/api/Unity.NetCode.MultiplayerPlayModePreferences.html Gets or sets a value indicating whether the client simulator UTP module is enabled. ```APIDOC ## SimulatorEnabled ### Description Stores whether or not the user wishes to use the client simulator UTP module. ### Property - **SimulatorEnabled** (bool) - Gets or sets a value indicating whether the client simulator UTP module is enabled. ### Property Value Type | Description ---|--- bool | ``` -------------------------------- ### Get NetworkGroupCommandBufferSystem Singleton Source: https://docs.unity3d.com/Packages/com.unity.netcode%401.10/api/Unity.NetCode.NetworkGroupCommandBufferSystem.Singleton.html Retrieve the singleton instance of NetworkGroupCommandBufferSystem.Singleton to create an Entity Command Buffer. ```csharp var commandBufferSystem = SystemAPI.GetSingleton(); ``` -------------------------------- ### GhostDespawnSystem OnCreate Method Source: https://docs.unity3d.com/Packages/com.unity.netcode%401.10/api/Unity.NetCode.GhostDespawnSystem.html The OnCreate method is called when the GhostDespawnSystem is created, used for setting up system resources before the first update. ```csharp public void OnCreate(ref SystemState state) { } ``` -------------------------------- ### Creating an Entity with an RPC Command Source: https://docs.unity3d.com/Packages/com.unity.netcode%401.10/api/Unity.NetCode.IRpcCommand.html Demonstrates the process of creating an entity with an RPC message component and a SendRpcCommandRequest to notify the NetCode system. It's recommended to use an archetype for this to avoid runtime structural changes. ```csharp m_RpcArchetype = EntityManager.CreateArchetype(..); var ent = EntityManager.CreateEntity(m_RpcArchetype); EntityManager.SetComponentData(new MyRpc ); ``` -------------------------------- ### Simulator Enabled Property Source: https://docs.unity3d.com/Packages/com.unity.netcode%401.10/api/Unity.NetCode.NetworkDriverStore.NetworkDriverInstance.html Get or set a flag indicating if the driver pipelines are using the Unity.Networking.Transport.SimulatorPipelineStage. ```csharp public bool simulatorEnabled { get; set; } ``` -------------------------------- ### ClientServerBootstrap Properties Source: https://docs.unity3d.com/Packages/com.unity.netcode%401.10/api/Unity.NetCode.ClientServerBootstrap.html Provides access to the created client worlds and checks for their existence. ```APIDOC ## ClientServerBootstrap Properties ### ClientWorld A reference to the client world, assigned during the default client world creation. If there were multiple worlds created this will be the first one. **Declaration:** ```csharp public static World ClientWorld { get; } ``` ### ClientWorlds A list of all client worlds (excluding thin client worlds!) created during the default creation flow. If this type of world is created manually (i.e. not via the bootstrap APIs), then this list needs to be manually populated. **Declaration:** ```csharp public static List ClientWorlds { get; } ``` ### HasClientWorlds Check if a world with a Unity.Entities.WorldFlags.GameClient is present. **Declaration:** ```csharp public static bool HasClientWorlds { get; } ``` ``` -------------------------------- ### Enable Client Simulator Source: https://docs.unity3d.com/Packages/com.unity.netcode%401.10/api/Unity.NetCode.MultiplayerPlayModePreferences.html Determines whether the user wishes to utilize the client simulator UTP module. ```csharp public static bool SimulatorEnabled { get; set; } ``` -------------------------------- ### Create Command Buffer (Syntax) Source: https://docs.unity3d.com/Packages/com.unity.netcode%401.10/api/Unity.NetCode.BeginPredictedSimulationEntityCommandBufferSystem.Singleton.html This is the declaration for creating a command buffer using the singleton. ```csharp public EntityCommandBuffer CreateCommandBuffer(WorldUnmanaged world) ``` -------------------------------- ### NetworkTick SerializedData Property Source: https://docs.unity3d.com/Packages/com.unity.netcode%401.10/api/Unity.NetCode.NetworkTick.html Gets or sets the serialized representation of the tick, which includes both its validity status and index. ```csharp public uint SerializedData { get; set; } ``` -------------------------------- ### TargetShouldDumpPackets Source: https://docs.unity3d.com/Packages/com.unity.netcode%401.10/api/Unity.NetCode.MultiplayerPlayModePreferences.html Gets or sets a value indicating whether NetDebugSystem loggers should dump packets when ApplyLoggerSettings is true. ```APIDOC ## TargetShouldDumpPackets ### Description If ApplyLoggerSettings, forces all NetDebugSystem loggers to have this value for ShouldDumpPackets. ### Property - **TargetShouldDumpPackets** (bool) - Gets or sets a value indicating whether NetDebugSystem loggers should dump packets. ### Property Value Type | Description ---|--- bool | ``` -------------------------------- ### BootstrapThinClientWorlds Method Source: https://docs.unity3d.com/Packages/com.unity.netcode%401.10/api/Unity.NetCode.AutomaticThinClientWorldsUtility.html Call this method during the Initialize(string) flow to bootstrap thin client worlds. It's necessary for Entities/Netcode's fast-path scene data injection. ```csharp public static void BootstrapThinClientWorlds() ``` -------------------------------- ### snapshotAckType Field Declaration Source: https://docs.unity3d.com/Packages/com.unity.netcode%401.10/api/Unity.NetCode.CommandReceiveSystem-2.ReceiveJobData.html Type handle to get the NetworkSnapshotAck for the connection. Used for acknowledging network snapshots. ```csharp public ComponentTypeHandle snapshotAckType ``` -------------------------------- ### ServerPopulatePrespawnedGhostsSystem Methods Source: https://docs.unity3d.com/Packages/com.unity.netcode%401.10/api/Unity.NetCode.ServerPopulatePrespawnedGhostsSystem.html Documentation for the methods available in the ServerPopulatePrespawnedGhostsSystem. ```APIDOC ## OnCreate(ref SystemState) ### Description Called when this system is created. Implement an `OnCreate` function to set up system resources when it is created. `OnCreate` is invoked before the the first time Unity.Entities.ISystemStartStop.OnStartRunning(ref Unity.Entities.SystemState) and Unity.Entities.ISystem.OnUpdate(ref Unity.Entities.SystemState) are invoked. ### Method public void OnCreate(ref SystemState state) ### Parameters #### Parameters - **state** (SystemState) - Required - The Unity.Entities.SystemState backing this system instance ### Remarks Implement an `OnCreate` function to set up system resources when it is created. `OnCreate` is invoked before the the first time Unity.Entities.ISystemStartStop.OnStartRunning(ref Unity.Entities.SystemState) and Unity.Entities.ISystem.OnUpdate(ref Unity.Entities.SystemState) are invoked. ### See Also ClientPopulatePrespawnedGhostsSystem ``` ```APIDOC ## OnCreateForCompiler(ref SystemState) ### Description Generated by compilation pipeline and used internally. ### Method public void OnCreateForCompiler(ref SystemState state) ### Parameters #### Parameters - **state** (SystemState) - Required - The Unity.Entities.SystemState backing this system instance ### See Also ClientPopulatePrespawnedGhostsSystem ``` ```APIDOC ## OnUpdate(ref SystemState) ### Description Implement `OnUpdate` to perform the major work of this system. By default, the system invokes `OnUpdate` once every frame on the main thread. ### Method public void OnUpdate(ref SystemState state) ### Parameters #### Parameters - **state** (SystemState) - Required - The Unity.Entities.SystemState backing this system instance ### Remarks By default, the system invokes `OnUpdate` once every frame on the main thread. To skip OnUpdate if all of the system's [EntityQueries] are empty, use the [RequireMatchingQueriesForUpdateAttribute]. To limit when OnUpdate is invoked, you can specify components that must exist, or queries that match specific Entities. To do this, call Unity.Entities.SystemState.RequireForUpdate() or Unity.Entities.SystemState.RequireForUpdate(Unity.Entities.EntityQuery) in the system's OnCreate method. For more information, see Unity.Entities.SystemState.ShouldRunSystem(). You can instantiate and schedule an Unity.Entities.IJobChunk instance; you can use the [C# Job System] or you can perform work on the main thread. If you call Unity.Entities.EntityManager methods that perform structural changes on the main thread, be sure to arrange the system order to minimize the performance impact of the resulting [sync points]. [sync points]: xref:concepts-structural-changes [C# Job System]: https://docs.unity3d.com/Manual/JobSystem.html [EntityQueries]: xref:Unity.Entities.EntityQuery [RequireMatchingQueriesForUpdateAttribute]: xref:Unity.Entities.RequireMatchingQueriesForUpdateAttribute ### See Also ClientPopulatePrespawnedGhostsSystem ``` -------------------------------- ### NetworkTimeSystem OnStartRunning Method Source: https://docs.unity3d.com/Packages/com.unity.netcode%401.10/api/Unity.NetCode.NetworkTimeSystem.html An empty method that implements the ISystemStartStop interface. It is called when the system begins running. ```csharp [BurstCompile] public void OnStartRunning(ref SystemState state) { } ``` -------------------------------- ### PrespawnedGhostPreprocessScene Methods Source: https://docs.unity3d.com/Packages/com.unity.netcode%401.10/api/Unity.NetCode.Editor.PrespawnedGhostPreprocessScene.html Provides documentation for the methods available in the PrespawnedGhostPreprocessScene struct. ```APIDOC ## PrespawnedGhostPreprocessScene ### Description Process in the editor any sub-scene open for edit that contains pre-spawned ghosts. This is a work-around for a limitation in the conversion workdflow that prevent custom component added to sceen section entity when a sub-scene is open for edit. To overcome that, the SubSceneWithPrespawnGhosts is added at runtime here and a LiveLinkPrespawnSectionReference is also added ot the scene section enity to provide some misisng information about the section is referring to. ### Methods #### OnCreate(ref SystemState) ##### Description Called when this system is created. ##### Declaration ```csharp [BurstCompile] public void OnCreate(ref SystemState state) ``` ##### Parameters - **state** (SystemState) - The Unity.Entities.SystemState backing this system instance ##### Remarks Implement an `OnCreate` function to set up system resources when it is created. `OnCreate` is invoked before the the first time Unity.Entities.ISystemStartStop.OnStartRunning(ref Unity.Entities.SystemState) and Unity.Entities.ISystem.OnUpdate(ref Unity.Entities.SystemState) are invoked. #### OnCreateForCompiler(ref SystemState) ##### Description Generated by compilation pipeline and used internally. ##### Declaration ```csharp public void OnCreateForCompiler(ref SystemState state) ``` ##### Parameters - **state** (SystemState) - The Unity.Entities.SystemState backing this system instance #### OnUpdate(ref SystemState) ##### Description Implement `OnUpdate` to perform the major work of this system. ##### Declaration ```csharp [BurstCompile] public void OnUpdate(ref SystemState state) ``` ##### Parameters - **state** (SystemState) - The Unity.Entities.SystemState backing this system instance ##### Remarks By default, the system invokes `OnUpdate` once every frame on the main thread. To skip OnUpdate if all of the system's [EntityQueries] are empty, use the [RequireMatchingQueriesForUpdateAttribute]. To limit when OnUpdate is invoked, you can specify components that must exist, or queries that match specific Entities. To do this, call Unity.Entities.SystemState.RequireForUpdate() or Unity.Entities.SystemState.RequireForUpdate(Unity.Entities.EntityQuery) in the system's OnCreate method. For more information, see Unity.Entities.SystemState.ShouldRunSystem(). You can instantiate and schedule an Unity.Entities.IJobChunk instance; you can use the [C# Job System] or you can perform work on the main thread. If you call Unity.Entities.EntityManager methods that perform structural changes on the main thread, be sure to arrange the system order to minimize the performance impact of the resulting [sync points]. [sync points]: xref:concepts-structural-changes [C# Job System]: https://docs.unity3d.com/Manual/JobSystem.html [EntityQueries]: xref:Unity.Entities.EntityQuery [RequireMatchingQueriesForUpdateAttribute]: xref:Unity.Entities.RequireMatchingQueriesForUpdateAttribute ``` -------------------------------- ### IsRuntimeInitializationEnabled Property Source: https://docs.unity3d.com/Packages/com.unity.netcode%401.10/api/Unity.NetCode.AutomaticThinClientWorldsUtility.html Indicates whether automatic thin client creation at runtime is enabled. ```csharp public static bool IsRuntimeInitializationEnabled { get; } ``` -------------------------------- ### NetworkDriverStore Fields Source: https://docs.unity3d.com/Packages/com.unity.netcode%401.10/api/Unity.NetCode.NetworkDriverStore.html Provides information about the constant fields of NetworkDriverStore, including its fixed Capacity and the starting ID for drivers. ```APIDOC ## Fields ### Capacity The fixed capacity of the driver container. * **Declaration:** `public const int Capacity = 3` ### FirstDriverId The first assigned unique identifier to each driver. * **Declaration:** `public const int FirstDriverId = 1` ``` -------------------------------- ### SupportedGhostModes Field Source: https://docs.unity3d.com/Packages/com.unity.netcode%401.10/api/Unity.NetCode.GhostPrefabCreation.Config.html Defines the ghost modes a prefab can be instantiated as. For example, setting 'Interpolated' prevents its use for prediction. ```csharp public GhostModeMask SupportedGhostModes ``` -------------------------------- ### CreateThinClientWorld Utility Source: https://docs.unity3d.com/Packages/com.unity.netcode%401.10/api/Unity.NetCode.ClientServerBootstrap.html Creates thin client worlds. This utility is suitable for custom `Initialize` implementations or for dynamically adding new clients at runtime. ```csharp public static World CreateThinClientWorld() ``` -------------------------------- ### GhostDespawnSystem Methods Source: https://docs.unity3d.com/Packages/com.unity.netcode%401.10/api/Unity.NetCode.GhostDespawnSystem.html Provides documentation for the methods available in the GhostDespawnSystem, including OnCreate, OnCreateForCompiler, OnDestroy, and OnUpdate. ```APIDOC ## GhostDespawnSystem Methods ### OnCreate - **Description**: Called when this system is created. Implement an `OnCreate` function to set up system resources when it is created. `OnCreate` is invoked before the the first time Unity.Entities.ISystemStartStop.OnStartRunning(ref Unity.Entities.SystemState) and Unity.Entities.ISystem.OnUpdate(ref Unity.Entities.SystemState) are invoked. - **Declaration**: `public void OnCreate(ref SystemState state)` - **Parameters**: - **state** (SystemState) - The Unity.Entities.SystemState backing this system instance ### OnCreateForCompiler - **Description**: Generated by compilation pipeline and used internally. - **Declaration**: `public void OnCreateForCompiler(ref SystemState state)` - **Parameters**: - **state** (SystemState) - The Unity.Entities.SystemState backing this system instance ### OnDestroy - **Description**: Called when this system is destroyed. Systems are destroyed when the application shuts down, the World is destroyed, or you call Unity.Entities.World.DestroySystem(Unity.Entities.SystemHandle). In the Unity Editor, system destruction occurs when you exit Play Mode and when scripts are reloaded. - **Declaration**: `[BurstCompile] public void OnDestroy(ref SystemState state)` - **Parameters**: - **state** (SystemState) - The Unity.Entities.SystemState backing this system instance ### OnUpdate - **Description**: Implement `OnUpdate` to perform the major work of this system. - **Declaration**: `[BurstCompile] public void OnUpdate(ref SystemState state)` - **Parameters**: - **state** (SystemState) - The Unity.Entities.SystemState backing this system instance ``` -------------------------------- ### Auto Connection Port Property Source: https://docs.unity3d.com/Packages/com.unity.netcode%401.10/api/Unity.NetCode.MultiplayerPlayModePreferences.html This static property allows setting and getting the auto-connection port for multiplayer sessions. ```csharp public static ushort AutoConnectionPort { get; set; } ``` -------------------------------- ### Auto Connection Address Property Source: https://docs.unity3d.com/Packages/com.unity.netcode%401.10/api/Unity.NetCode.MultiplayerPlayModePreferences.html This static property allows setting and getting the auto-connection address for multiplayer sessions. ```csharp public static string AutoConnectionAddress { get; set; } ``` -------------------------------- ### System Execution and Job Scheduling in Unity Netcode Source: https://docs.unity3d.com/Packages/com.unity.netcode%401.10/api/Unity.NetCode.GhostSendSystem.html Illustrates how to manage system execution, including conditional updates and the choice between main thread work and C# Job System for chunk-based jobs. It highlights the importance of ordering systems to minimize performance impacts from structural changes. ```csharp using Unity.Entities; public partial class GhostSendSystem : SystemBase { protected override void OnUpdate() { // By default, OnUpdate is invoked once every frame on the main thread. // To skip OnUpdate if all of the system's EntityQueries are empty, use RequireMatchingQueriesForUpdateAttribute. // To limit when OnUpdate is invoked, you can specify components that must exist, or queries that match specific Entities. // To do this, call Unity.Entities.SystemState.RequireForUpdate() or Unity.Entities.SystemState.RequireForUpdate(Unity.Entities.EntityQuery) in the system's OnCreate method. // For more information, see Unity.Entities.SystemState.ShouldRunSystem(). // You can instantiate and schedule an Unity.Entities.IJobChunk instance; // you can use the C# Job System or you can perform work on the main thread. // If you call Unity.Entities.EntityManager methods that perform structural changes on the main thread, be sure to arrange the system order to minimize the performance impact of the resulting sync points. } } ``` -------------------------------- ### BlobStringText Capacity Property Source: https://docs.unity3d.com/Packages/com.unity.netcode%401.10/api/Unity.NetCode.LowLevel.BlobStringText.html Gets or sets the number of elements that fit in the current allocation. Always throws NotImplementedException. ```csharp public int Capacity { get; set; } ``` -------------------------------- ### DefaultRuntimeThinClientWorldInitialization Source: https://docs.unity3d.com/Packages/com.unity.netcode%401.10/api/Unity.NetCode.AutomaticThinClientWorldsUtility.html Allows for custom runtime initialization of automatic thin client worlds, useful for custom scene management. It defaults to DefaultRuntimeThinClientWorldInitialization(World) and can be set to null to disable this feature. ```APIDOC ## DefaultRuntimeThinClientWorldInitialization(World) ### Description If your automatic thin clients need custom initialization at runtime (e.g. due to custom scene management settings), modify this delegate. Uses DefaultRuntimeThinClientWorldInitialization(World) by default. Set to null to disable the runtime initialization feature. ### Method `public static World DefaultRuntimeThinClientWorldInitialization(World referenceWorld)` ### Parameters #### Path Parameters - **referenceWorld** (World) - Description: The world to reference when creating this one (for the purposes of scene loading etc.). ### Returns #### Success Response - **World** - Description: The newly created world, otherwise null. ``` -------------------------------- ### IGhostSerializer SizeInSnapshot Property Source: https://docs.unity3d.com/Packages/com.unity.netcode%401.10/api/Unity.NetCode.IGhostSerializer.html Gets the size, in bytes, of the serialized data for a ghost component within a snapshot buffer. ```csharp int SizeInSnapshot { get; } ``` -------------------------------- ### Create Client World with Name Source: https://docs.unity3d.com/Packages/com.unity.netcode%401.10/api/Unity.NetCode.ClientServerBootstrap.html Utility method for creating new client worlds. Useful for custom initializations, adding clients dynamically at runtime, or programmatic creation. ```csharp public static World CreateClientWorld(string name) ```