docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Class GhostAuthoringInspectionComponent

    MonoBehaviour you may optionally add to any/all GameObjects in a Ghost Prefab, which allows inspecting of (and saving of) "Ghost Meta Data". E.g.

    - Override/Tweak some of the component replication properties, for both child and root entities.

    - Assign to each component which variant to use.

    Inheritance
    object
    Object
    Component
    Behaviour
    MonoBehaviour
    GhostAuthoringInspectionComponent
    Inherited Members
    MonoBehaviour.IsInvoking()
    MonoBehaviour.CancelInvoke()
    MonoBehaviour.Invoke(string, float)
    MonoBehaviour.InvokeRepeating(string, float, float)
    MonoBehaviour.CancelInvoke(string)
    MonoBehaviour.IsInvoking(string)
    MonoBehaviour.StartCoroutine(string)
    MonoBehaviour.StartCoroutine(string, object)
    MonoBehaviour.StartCoroutine(IEnumerator)
    MonoBehaviour.StartCoroutine_Auto(IEnumerator)
    MonoBehaviour.StopCoroutine(IEnumerator)
    MonoBehaviour.StopCoroutine(Coroutine)
    MonoBehaviour.StopCoroutine(string)
    MonoBehaviour.StopAllCoroutines()
    MonoBehaviour.print(object)
    MonoBehaviour.destroyCancellationToken
    MonoBehaviour.useGUILayout
    MonoBehaviour.didStart
    MonoBehaviour.didAwake
    MonoBehaviour.runInEditMode
    Behaviour.enabled
    Behaviour.isActiveAndEnabled
    Component.GetComponent(Type)
    Component.GetComponent<T>()
    Component.TryGetComponent(Type, out Component)
    Component.TryGetComponent<T>(out T)
    Component.GetComponent(string)
    Component.GetComponentInChildren(Type, bool)
    Component.GetComponentInChildren(Type)
    Component.GetComponentInChildren<T>(bool)
    Component.GetComponentInChildren<T>()
    Component.GetComponentsInChildren(Type, bool)
    Component.GetComponentsInChildren(Type)
    Component.GetComponentsInChildren<T>(bool)
    Component.GetComponentsInChildren<T>(bool, List<T>)
    Component.GetComponentsInChildren<T>()
    Component.GetComponentsInChildren<T>(List<T>)
    Component.GetComponentInParent(Type, bool)
    Component.GetComponentInParent(Type)
    Component.GetComponentInParent<T>(bool)
    Component.GetComponentInParent<T>()
    Component.GetComponentsInParent(Type, bool)
    Component.GetComponentsInParent(Type)
    Component.GetComponentsInParent<T>(bool)
    Component.GetComponentsInParent<T>(bool, List<T>)
    Component.GetComponentsInParent<T>()
    Component.GetComponents(Type)
    Component.GetComponents(Type, List<Component>)
    Component.GetComponents<T>(List<T>)
    Component.GetComponents<T>()
    Component.GetComponentIndex()
    Component.CompareTag(string)
    Component.CompareTag(TagHandle)
    Component.SendMessageUpwards(string, object, SendMessageOptions)
    Component.SendMessageUpwards(string, object)
    Component.SendMessageUpwards(string)
    Component.SendMessageUpwards(string, SendMessageOptions)
    Component.SendMessage(string, object)
    Component.SendMessage(string)
    Component.SendMessage(string, object, SendMessageOptions)
    Component.SendMessage(string, SendMessageOptions)
    Component.BroadcastMessage(string, object, SendMessageOptions)
    Component.BroadcastMessage(string, object)
    Component.BroadcastMessage(string)
    Component.BroadcastMessage(string, SendMessageOptions)
    Component.transform
    Component.transformHandle
    Component.gameObject
    Component.tag
    Object.GetEntityId()
    Object.MemberwiseClone()
    Object.GetInstanceID()
    Object.GetHashCode()
    Object.Equals(object)
    Object.InstantiateAsync<T>(T)
    Object.InstantiateAsync<T>(T, Transform)
    Object.InstantiateAsync<T>(T, Vector3, Quaternion)
    Object.InstantiateAsync<T>(T, Transform, Vector3, Quaternion)
    Object.InstantiateAsync<T>(T, int)
    Object.InstantiateAsync<T>(T, int, Transform)
    Object.InstantiateAsync<T>(T, int, Vector3, Quaternion)
    Object.InstantiateAsync<T>(T, int, ReadOnlySpan<Vector3>, ReadOnlySpan<Quaternion>)
    Object.InstantiateAsync<T>(T, int, Transform, Vector3, Quaternion)
    Object.InstantiateAsync<T>(T, int, Transform, Vector3, Quaternion, CancellationToken)
    Object.InstantiateAsync<T>(T, int, Transform, ReadOnlySpan<Vector3>, ReadOnlySpan<Quaternion>)
    Object.InstantiateAsync<T>(T, int, Transform, ReadOnlySpan<Vector3>, ReadOnlySpan<Quaternion>, CancellationToken)
    Object.InstantiateAsync<T>(T, InstantiateParameters, CancellationToken)
    Object.InstantiateAsync<T>(T, int, InstantiateParameters, CancellationToken)
    Object.InstantiateAsync<T>(T, Vector3, Quaternion, InstantiateParameters, CancellationToken)
    Object.InstantiateAsync<T>(T, int, Vector3, Quaternion, InstantiateParameters, CancellationToken)
    Object.InstantiateAsync<T>(T, int, ReadOnlySpan<Vector3>, ReadOnlySpan<Quaternion>, InstantiateParameters, CancellationToken)
    Object.Instantiate(Object, Vector3, Quaternion)
    Object.Instantiate(Object, Vector3, Quaternion, Transform)
    Object.Instantiate(Object)
    Object.Instantiate(Object, Scene)
    Object.Instantiate<T>(T, InstantiateParameters)
    Object.Instantiate<T>(T, Vector3, Quaternion, InstantiateParameters)
    Object.Instantiate(Object, Transform)
    Object.Instantiate(Object, Transform, bool)
    Object.Instantiate<T>(T)
    Object.Instantiate<T>(T, Vector3, Quaternion)
    Object.Instantiate<T>(T, Vector3, Quaternion, Transform)
    Object.Instantiate<T>(T, Transform)
    Object.Instantiate<T>(T, Transform, bool)
    Object.Destroy(Object, float)
    Object.Destroy(Object)
    Object.DestroyImmediate(Object, bool)
    Object.DestroyImmediate(Object)
    Object.FindObjectsOfType(Type)
    Object.FindObjectsOfType(Type, bool)
    Object.FindObjectsByType(Type, FindObjectsSortMode)
    Object.FindObjectsByType(Type, FindObjectsInactive, FindObjectsSortMode)
    Object.FindObjectsByType(Type)
    Object.FindObjectsByType(Type, FindObjectsInactive)
    Object.DontDestroyOnLoad(Object)
    Object.DestroyObject(Object, float)
    Object.DestroyObject(Object)
    Object.FindSceneObjectsOfType(Type)
    Object.FindObjectsOfTypeIncludingAssets(Type)
    Object.FindObjectsOfType<T>()
    Object.FindObjectsByType<T>(FindObjectsSortMode)
    Object.FindObjectsOfType<T>(bool)
    Object.FindObjectsByType<T>(FindObjectsInactive, FindObjectsSortMode)
    Object.FindObjectOfType<T>()
    Object.FindObjectOfType<T>(bool)
    Object.FindFirstObjectByType<T>()
    Object.FindAnyObjectByType<T>()
    Object.FindFirstObjectByType<T>(FindObjectsInactive)
    Object.FindAnyObjectByType<T>(FindObjectsInactive)
    Object.FindObjectsByType<T>()
    Object.FindObjectsByType<T>(FindObjectsInactive)
    Object.FindObjectsOfTypeAll(Type)
    Object.FindObjectOfType(Type)
    Object.FindFirstObjectByType(Type)
    Object.FindAnyObjectByType(Type)
    Object.FindObjectOfType(Type, bool)
    Object.FindFirstObjectByType(Type, FindObjectsInactive)
    Object.FindAnyObjectByType(Type, FindObjectsInactive)
    Object.name
    Object.hideFlags
    object.Equals(object, object)
    object.GetType()
    object.ReferenceEquals(object, object)
    Namespace: Unity.NetCode
    Assembly: Unity.NetCode.Authoring.Hybrid.dll
    Syntax
    [DisallowMultipleComponent]
    [HelpURL("https://docs.unity3d.com/Packages/com.unity.netcode@latest/index.html?subfolder=/api/Unity.NetCode.GhostAuthoringInspectionComponent.html")]
    public class GhostAuthoringInspectionComponent : MonoBehaviour

    Properties

    OverrideCount

    Number of saved overrides on this inspection component.

    Declaration
    public int OverrideCount { get; }
    Property Value
    Type Description
    int
    See Also
    GhostAuthoringComponent

    Methods

    CollectAllComponentOverridesInInspectionComponents(BaseGhostSettings, bool)

    Finds all GhostAuthoringInspectionComponent's on this Ghost Authoring Prefab (including in children) and flattens their overrides into one list, paired with the GameObject each override was authored on.

    Declaration
    public static List<(GameObject, GhostAuthoringInspectionComponent.ComponentOverride)> CollectAllComponentOverridesInInspectionComponents(BaseGhostSettings ghostAuthoring, bool validate)
    Parameters
    Type Name Description
    BaseGhostSettings ghostAuthoring

    Root prefab to search from.

    bool validate

    If true, calls LogErrorIfComponentOverrideIsInvalid() on each inspection component visited.

    Returns
    Type Description
    List<(GameObject, GhostAuthoringInspectionComponent.ComponentOverride)>

    A flat list of every override across the prefab hierarchy, each paired with the GameObject that hosts the inspection component the override was authored on.

    See Also
    GhostAuthoringComponent

    CollectAllInspectionComponents(BaseGhostSettings)

    Returns every GhostAuthoringInspectionComponent attached to ghostAuthoring's GameObject or any descendant.

    Declaration
    public static List<GhostAuthoringInspectionComponent> CollectAllInspectionComponents(BaseGhostSettings ghostAuthoring)
    Parameters
    Type Name Description
    BaseGhostSettings ghostAuthoring

    The ghost authoring whose GameObject hierarchy is searched.

    Returns
    Type Description
    List<GhostAuthoringInspectionComponent>

    A list containing the inspection components on the root GameObject followed by those on every descendant. Empty if none are present.

    See Also
    GhostAuthoringComponent

    EnumerateOverrides()

    Read-only view of the saved overrides. Mutate via GetOrAddPrefabOverride(Type, EntityGuid, GhostPrefabType) + SavePrefabOverride(ref ComponentOverride, string) or RemoveComponentOverrideByIndex(int) so the editor's dirty/save signal fires correctly.

    Declaration
    public IReadOnlyList<GhostAuthoringInspectionComponent.ComponentOverride> EnumerateOverrides()
    Returns
    Type Description
    IReadOnlyList<GhostAuthoringInspectionComponent.ComponentOverride>

    A read-only view backed directly by the underlying override array; iteration order is the array's storage order.

    See Also
    GhostAuthoringComponent

    FindExistingOverrideIndex(ref ComponentOverride)

    Finds the array index of currentOverride by matching FullTypeName (case-insensitive). Throws if not found.

    Declaration
    public int FindExistingOverrideIndex(ref GhostAuthoringInspectionComponent.ComponentOverride currentOverride)
    Parameters
    Type Name Description
    GhostAuthoringInspectionComponent.ComponentOverride currentOverride

    The override entry to locate. Passed by ref so callers holding a ref into the underlying array can ask "where am I?" without copying.

    Returns
    Type Description
    int

    The position of currentOverride in the underlying array.

    Remarks

    Intended for callers holding a ref obtained from GetOrAddPrefabOverride(Type, EntityGuid, GhostPrefabType) — the entry MUST exist by construction. For non-ref lookups, use TryFindExistingOverrideIndex(Type, in EntityGuid, out int).

    See Also
    GhostAuthoringComponent

    GetOrAddPrefabOverride(Type, EntityGuid, GhostPrefabType)

    Returns the existing GhostAuthoringInspectionComponent.ComponentOverride for (managedType, entityGuid) on this inspection component, or appends a new entry initialized with defaultPrefabType and returns that.

    Declaration
    public ref GhostAuthoringInspectionComponent.ComponentOverride GetOrAddPrefabOverride(Type managedType, EntityGuid entityGuid, GhostPrefabType defaultPrefabType)
    Parameters
    Type Name Description
    Type managedType

    The component type to override. Matched (case-insensitive) against FullTypeName.

    EntityGuid entityGuid

    The entity within the prefab hierarchy this override targets. Must match either this GameObject's entity id or one of its descendants', else throws.

    GhostPrefabType defaultPrefabType

    Initial PrefabType when a new entry is appended. Ignored when an existing entry is returned.

    Returns
    Type Description
    GhostAuthoringInspectionComponent.ComponentOverride

    A ref to the existing or newly-appended override entry. Caller must call SavePrefabOverride(ref ComponentOverride, string) after mutating it.

    Remarks

    Returns by ref into the underlying serialized array. The ref is invalidated by any subsequent call to GetOrAddPrefabOverride(Type, EntityGuid, GhostPrefabType) that adds a NEW entry, or by RemoveComponentOverrideByIndex(int) — both can resize the backing array. Don't hold the ref across those calls.

    This operation is NOT persisted. Call SavePrefabOverride(ref ComponentOverride, string) after mutating the returned ref to flag the inspection component as dirty.

    See Also
    GhostAuthoringComponent

    RemoveComponentOverrideByIndex(int)

    Removes the override at index by swapping in the last element and resizing. Order of remaining entries is not preserved.

    Declaration
    public void RemoveComponentOverrideByIndex(int index)
    Parameters
    Type Name Description
    int index

    Position in the override array to remove. Out-of-range indices are silently ignored when the array is empty; otherwise behaviour matches a normal indexed write to the array.

    Remarks

    Invalidates any ref previously obtained from GetOrAddPrefabOverride(Type, EntityGuid, GhostPrefabType).

    See Also
    GhostAuthoringComponent

    SavePrefabOverride(ref ComponentOverride, string)

    Persists changes made to componentOverride (by-ref). If the override no longer carries any overridden fields (HasOverriden is false), removes it from the array entirely.

    Declaration
    public void SavePrefabOverride(ref GhostAuthoringInspectionComponent.ComponentOverride componentOverride, string reason)
    Parameters
    Type Name Description
    GhostAuthoringInspectionComponent.ComponentOverride componentOverride

    The override entry being saved, passed by ref so that auto-removal (when no fields are overridden) can resolve its index.

    string reason

    Free-text reason for the save, useful when debugging editor undo/save flow. Not persisted.

    Remarks

    At runtime this only flags the editor signal that drives a re-save; outside the editor the flag is harmless.

    See Also
    GhostAuthoringComponent

    TryFindExistingOverrideIndex(string, in ulong, out int)

    Looks up the index of the override matching managedTypeFullName + entityGuid, if one exists. The string overload exists so callers without a runtime Type handle (e.g. tooling reading serialized prefab data) can still query.

    Declaration
    public bool TryFindExistingOverrideIndex(string managedTypeFullName, in ulong entityGuid, out int index)
    Parameters
    Type Name Description
    string managedTypeFullName

    Component type's FullName; compared case-insensitively against FullTypeName.

    ulong entityGuid

    The entity serial to match (mirrors Serial).

    int index

    Set to the matching index when this method returns true; -1 otherwise.

    Returns
    Type Description
    bool

    True if found; index is the position in the override list, else -1.

    See Also
    GhostAuthoringComponent

    TryFindExistingOverrideIndex(Type, in EntityGuid, out int)

    Looks up the index of the override targeting managedType on the entity identified by guid, if one exists.

    Declaration
    public bool TryFindExistingOverrideIndex(Type managedType, in EntityGuid guid, out int index)
    Parameters
    Type Name Description
    Type managedType

    Component type to match. FullName is compared case-insensitively against FullTypeName.

    EntityGuid guid

    Entity identifier within the prefab; only Serial is used.

    int index

    Set to the matching index when this method returns true; -1 otherwise.

    Returns
    Type Description
    bool

    True if found; index is the position in the override list, else -1.

    See Also
    GhostAuthoringComponent

    See Also

    GhostAuthoringComponent
    In This Article
    Back to top
    Copyright © 2026 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)