Struct GhostRelevancy
Singleton entity present on the server. Every frame, collect the set of ghosts that should be (or should not be) replicated to a given client.
Implements
Inherited Members
Namespace: Unity.NetCode
Assembly: Unity.NetCode.dll
Syntax
public struct GhostRelevancy : IComponentData, IQueryTypeParameter
Remarks
Use GhostRelevancy to avoid replicating entities that the player can neither see, nor interact with.
Fields
DefaultRelevancyQuery
Use this query to specify the default per-component type rules about which ghosts should be relevant. Note, however, that this filter is overridden by GhostRelevancySet. For example Mode = SetIsRelevant, DefaultRelevancyQuery = Any<MyComponentA>, GhostRelevancySet = ghostWithComponentB
- All ghosts with MyComponentA + the single ghostWithComponentB will be relevant Mode = SetIsIrrelevant, DefaultRelevancyQuery = Any<MyComponentA>, GhostRelevancySet = ghostWithComponentA
- All ghosts with MyComponentA will be relevant, except the single ghostWithComponentA
Declaration
public EntityQuery DefaultRelevancyQuery
Field Value
Type | Description |
---|---|
EntityQuery |
Remarks
Since this is translating to a Unity.Entities.EntityQueryMask internally, the same restrictions apply for filtering. Ensure your query uses the Any filter if you have multiple ghost types which should all be considered always relevant by default.
GhostRelevancyMode
Specify if the ghosts present in the GhostRelevancySet should be replicated (relevant) or not replicated (irrelevant) to the the client.
Declaration
public GhostRelevancyMode GhostRelevancyMode
Field Value
Type | Description |
---|---|
GhostRelevancyMode |
GhostRelevancySet
A sorted collection of (connection, ghost) pairs, that should be used to specify which ghosts, for a given connection, should be replicated (or not replicated, based on the GhostRelevancyMode) for the current simulated tick. For per-component type rules, see DefaultRelevancyQuery.
Declaration
public readonly NativeParallelHashMap<RelevantGhostForConnection, int> GhostRelevancySet
Field Value
Type | Description |
---|---|
NativeParallelHashMap<RelevantGhostForConnection, int> |