docs.unity3d.com
    Show / Hide Table of Contents

    Class GhostSendSystem

    Inheritance
    Object
    ComponentSystemBase
    SystemBase
    GhostSendSystem
    Inherited Members
    SystemBase.CompleteDependency()
    SystemBase.Update()
    SystemBase.GetComponent<T>(Entity)
    SystemBase.SetComponent<T>(Entity, T)
    SystemBase.HasComponent<T>(Entity)
    SystemBase.GetComponentDataFromEntity<T>(Boolean)
    SystemBase.GetBuffer<T>(Entity, Boolean)
    SystemBase.GetBufferFromEntity<T>(Boolean)
    SystemBase.GetStorageInfoFromEntity()
    Unity.Entities.SystemBase.UnmanagedUpdate$BurstManaged(System.IntPtr, Unity.Entities.SystemDependencySafetyUtility.SafetyErrorDetails)
    SystemBase.Dependency
    SystemBase.Entities
    SystemBase.Job
    ComponentSystemBase.OnCreateForCompiler()
    ComponentSystemBase.OnStartRunning()
    ComponentSystemBase.OnStopRunning()
    ComponentSystemBase.ShouldRunSystem()
    ComponentSystemBase.GetComponentTypeHandle<T>(Boolean)
    ComponentSystemBase.GetDynamicComponentTypeHandle(ComponentType)
    ComponentSystemBase.GetBufferTypeHandle<T>(Boolean)
    ComponentSystemBase.GetSharedComponentTypeHandle<T>()
    ComponentSystemBase.GetDynamicSharedComponentTypeHandle(ComponentType)
    ComponentSystemBase.GetEntityTypeHandle()
    ComponentSystemBase.RequireForUpdate(EntityQuery)
    ComponentSystemBase.RequireSingletonForUpdate<T>()
    ComponentSystemBase.HasSingleton<T>()
    ComponentSystemBase.GetSingleton<T>()
    ComponentSystemBase.TryGetSingleton<T>(T)
    ComponentSystemBase.SetSingleton<T>(T)
    ComponentSystemBase.GetSingletonEntity<T>()
    ComponentSystemBase.TryGetSingletonEntity<T>(Entity)
    ComponentSystemBase.GetEntityQuery(ComponentType[])
    ComponentSystemBase.GetEntityQuery(NativeArray<ComponentType>)
    ComponentSystemBase.GetEntityQuery(EntityQueryDesc[])
    ComponentSystemBase.GetEntityQuery(EntityQueryDescBuilder)
    ComponentSystemBase.Enabled
    ComponentSystemBase.EntityQueries
    ComponentSystemBase.GlobalSystemVersion
    ComponentSystemBase.LastSystemVersion
    ComponentSystemBase.EntityManager
    ComponentSystemBase.World
    ComponentSystemBase.SystemHandleUntyped
    ComponentSystemBase.Time
    Namespace: Unity.NetCode
    Syntax
    [UpdateInGroup(typeof(ServerSimulationSystemGroup), OrderLast = true)]
    [UpdateAfter(typeof(EndSimulationEntityCommandBufferSystem))]
    public class GhostSendSystem : SystemBase, IGhostMappingSystem

    Fields

    CleanupConnectionStatePerTick

    The number of connections to cleanup unused serialization data for in a single tick. Setting this higher can recover memory faster, but uses more CPU time.

    Declaration
    public int CleanupConnectionStatePerTick
    Field Value
    Type Description
    Int32

    EnablePerComponentProfiling

    Enable profiling scopes for each component in a ghost. They can help tracking down why a ghost is expensive to serialize - but they come with a performance cost so they are not enabled by default.

    Declaration
    public bool EnablePerComponentProfiling
    Field Value
    Type Description
    Boolean

    ForcePreSerialize

    Force all ghosts to use pre serialization. This means part of the serialization will be done once for all connection instead of once per connection. This can increase CPU time for simple ghosts and ghosts which are rarely sent. This switch is meant as a way of measuring which ghosts would benefit from using pre-serialization.

    Declaration
    public bool ForcePreSerialize
    Field Value
    Type Description
    Boolean

    ForceSingleBaseline

    Force all ghosts to use a single baseline. This will reduce CPU usage at the expense of increased bandwidth usage. This is mostly meant as a way of measuring which ghosts should use static optimization instead of dynamic. If the bits / ghost does not significantly increase when enabling this the ghost can use static optimization to save CPU.

    Declaration
    public bool ForceSingleBaseline
    Field Value
    Type Description
    Boolean

    KeepSnapshotHistoryOnStructuralChange

    Try to keep the snapshot history buffer for an entity when there is a structucal change. Doing this will require a lookup and copy of data whenever a ghost has a structucal change which will add additional CPU cost on the server. Keeping the snapshot history will not always be possible so this flag does no give a 100% guarantee, you are expected to measure CPU and bandwidth when changing this.

    Declaration
    public bool KeepSnapshotHistoryOnStructuralChange
    Field Value
    Type Description
    Boolean

    m_AllocatedGhostIds

    Declaration
    protected NativeArray<int> m_AllocatedGhostIds
    Field Value
    Type Description
    NativeArray<Int32>

    MaxSendChunks

    The maximum number of chunks the system will try to send to a single connection in a single frame. A chunk will count as sent even if it does not contain any ghosts which needed to be sent (because of relevancy or static optimization). If there are more chunks than this the least important chunks will not be sent even if there is space in the packet. This can be used to control CPU time on the server.

    Declaration
    public int MaxSendChunks
    Field Value
    Type Description
    Int32

    MaxSendEntities

    The maximum number of entities the system will try to send to a single connection in a single frame. An entity will count even if it is not actually sent (because of relevancy or static optimization). If there are more chunks than this the least important chunks will not be sent even if there is space in the packet. This can be used to control CPU time on the server.

    Declaration
    public int MaxSendEntities
    Field Value
    Type Description
    Int32

    MinDistanceScaledSendImportance

    The minimum importance considered for inclusion in a snapshot after applying distance based priority scaling. Any ghost importance lower than this value will not be send every frame even if there is enough space in the packet.

    Declaration
    public int MinDistanceScaledSendImportance
    Field Value
    Type Description
    Int32

    MinSendImportance

    The minimum importance considered for inclusion in a snapshot. Any ghost importance lower than this value will not be send every frame even if there is enough space in the packet. E.g. Value=60, tick-rate=60, ghost.importance=1 implies a ghost will be replicated roughly once per second.

    Declaration
    public int MinSendImportance
    Field Value
    Type Description
    Int32

    Properties

    FirstSendImportanceMultiplier

    Non-zero values for MinSendImportance can cause both: a) 'unchanged chunks that are "new" to a new-joiner' and b) 'newly spawned chunks' to be ignored by the replication priority system for multiple seconds. If this behaviour is undesirable, set this to be above MinSendImportance. This multiplies the importance value used on those "new" (to the player or to the world) ghost chunks. Note: This does not guarantee delivery of all "new" chunks, it only guarantees that every ghost chunk will get serialized and sent at least once per connection, as quickly as possible (e.g. assuming you have the bandwidth for it).

    Declaration
    public uint FirstSendImportanceMultiplier { get; set; }
    Property Value
    Type Description
    UInt32

    GhostRelevancyMode

    Declaration
    public GhostRelevancyMode GhostRelevancyMode { get; set; }
    Property Value
    Type Description
    GhostRelevancyMode

    GhostRelevancySet

    Declaration
    public NativeParallelHashMap<RelevantGhostForConnection, int> GhostRelevancySet { get; }
    Property Value
    Type Description
    NativeParallelHashMap<RelevantGhostForConnection, Int32>

    GhostRelevancySetWriteHandle

    Declaration
    public JobHandle GhostRelevancySetWriteHandle { get; set; }
    Property Value
    Type Description
    JobHandle

    IrrelevantImportanceDownScale

    Value used to scale down the importance of chunks where all entities were irrelevant last time it was sent. The importance is divided by this value. It can be used together with MinSendImportance to make sure relevancy is not updated every frame for things with low importance.

    Declaration
    public int IrrelevantImportanceDownScale { get; set; }
    Property Value
    Type Description
    Int32

    LastGhostMapWriter

    Declaration
    public JobHandle LastGhostMapWriter { get; set; }
    Property Value
    Type Description
    JobHandle
    Implements
    IGhostMappingSystem.LastGhostMapWriter

    SpawnedGhostEntityMap

    Declaration
    public NativeParallelHashMap<SpawnedGhost, Entity> SpawnedGhostEntityMap { get; }
    Property Value
    Type Description
    NativeParallelHashMap<SpawnedGhost, Entity>
    Implements
    IGhostMappingSystem.SpawnedGhostEntityMap

    Methods

    OnCreate()

    Declaration
    protected override void OnCreate()
    Overrides
    ComponentSystemBase.OnCreate()

    OnDestroy()

    Declaration
    protected override void OnDestroy()
    Overrides
    ComponentSystemBase.OnDestroy()

    OnUpdate()

    Declaration
    protected override void OnUpdate()
    Overrides
    SystemBase.OnUpdate()
    Back to top
    Terms of use
    Copyright © 2023 Unity Technologies — Terms of use
    • Legal
    • Privacy Policy
    • Cookies
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)
    "Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
    Generated by DocFX on 18 October 2023