Class GhostAuthoringComponent
The GhostAuthoringComponent is the main entry point to configure and create replicated ghosts types. The component must be added only to the GameObject hierarchy root.
It allows setting all ghost properties,
such as the replication mode Supported
Inherited Members
Namespace: Unity.NetCode
Assembly: solution.dll
Syntax
[RequireComponent(typeof(LinkedEntityGroupAuthoring))]
[DisallowMultipleComponent]
[HelpURL("https://docs.unity3d.com/Packages/com.unity.netcode@latest/index.html?subfolder=/api/Unity.NetCode.GhostAuthoringComponent.html")]
public class GhostAuthoringComponent : MonoBehaviour
Fields
Name | Description |
---|---|
Default |
The ghost mode used if you do not manually change it using a GhostSpawnClassificationSystem. If set to OwnerPredicted the ghost will be predicted on the client which owns it and interpolated elsewhere. You must not change the mode using a classification system if using owner predicted. |
Force |
Force the ghost baker to treat this GameObject as if it was a prefab. This is used if you want to programmatically create a ghost prefab as a GameObject and convert it to an Entity prefab with ConvertGameObjectHierarchy. |
Ghost |
Add a GhostGroup component which makes it possible for this entity to be the root of a ghost group. |
Has |
Add a GhostOwner tracking which connection owns this component. You must set the GhostOwner to a valid NetworkId.Value at runtime. |
Importance | If not all ghosts can fit in a snapshot only the most important ghosts will be sent. Higher importance means the ghost is more likely to be sent. |
Optimization |
This setting is only for optimization, the ghost will be sent when modified regardless of this setting. Optimizing for static makes snapshots slightly larger when they change, but smaller when they do not change. |
Support |
Automatically send all ICommandData buffers if the ghost is owned by the current connection, AutoCommandTarget.Enabled is true and the ghost is predicted. |
Supported |
The ghost modes supported by this ghost. This will perform some more optimizations at authoring time but make it impossible to change ghost mode at runtime. |
Track |
Add a CommandDataInterpolationDelay component so the interpolation delay of each client is tracked. This is used for server side lag-compensation. |
Use |
Force this ghost to be quantized and copied to the snapshot format once for all connections instead of once per connection. This can save CPU time in the ghost send system if the ghost is almost always sent to at least one connection, and it contains many serialized components, serialized components on child entities or serialized buffers. A common case where this can be useful is the ghost for the character / player. |
Properties
Name | Description |
---|---|
Supports |
True if we can apply the Ghost |
Methods
Name | Description |
---|---|
Get |
Validate the name of the GameObject prefab. |