docs.unity3d.com
    Show / Hide Table of Contents

    Struct GhostCollection

    A component used to identify the singleton which owns the ghost collection lists and data. The singleton contains buffers for GhostCollectionPrefab, GhostCollectionPrefabSerializer, GhostCollectionComponentIndex and GhostComponentSerializer.State

    Inherited Members
    ValueType.Equals(Object)
    ValueType.GetHashCode()
    Object.Equals(Object, Object)
    Object.ReferenceEquals(Object, Object)
    Object.GetType()
    Namespace: Unity.NetCode
    Syntax
    public struct GhostCollection : IComponentData, IQueryTypeParameter

    Fields

    IsInGame

    Flag set when there is at least one NetworkStreamConnection that is game.

    Declaration
    public bool IsInGame
    Field Value
    Type Description
    Boolean

    NumLoadedPrefabs

    The number prefab that has been loaded into the GhostCollectionPrefab collection. Use to determine which ghosts types the server can stream to the clients.

    The server report to the client the list of loaded prefabs (with their see GhostType guid) as part of the snapshot protocol. The list is dynamic; new prefabs can be added/loaded at runtime on the server, and the ones will be reported to the client.

    Clients reports to the server the number of loaded prefab as part of the command protocol. When the client receive a ghost snapshot, the ghost prefab list is processed and the GhostCollectionPrefab collection is updated with any new ghost types not present in the collection.

    The client is not required to have all prefab type in the GhostCollectionPrefab to be loaded into the world. They can be loaded/added dynamically to the world (i.e when streaming a sub-scene), and the Loading state should be used in that case to inform the GhostCollection that the specified prefabs are getting loaded into the world.

    Declaration
    public int NumLoadedPrefabs
    Field Value
    Type Description
    Int32
    In This Article
    • Fields
      • IsInGame
      • NumLoadedPrefabs
    Back to top
    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