{!See https://docs.google.com/document/d/1takg_GmIBBKKTj-GHZCwzxohpQz7Bhekivkk72kYMtE/edit for reference implementation of OneTrust, dataLayer and GTM} {!OneTrust Cookies Consent} {!OneTrust Cookies Consent end} {!dataLayer initialization push} {!dataLayer initialization push end} {!Google Tag Manager} {!Google Tag Manager end} Method ConvertToGhostPrefab | Netcode for Entities | 1.1.0-pre.3
docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Method ConvertToGhostPrefab

    ConvertToGhostPrefab(EntityManager, Entity, Config, NativeParallelHashMap<Component, ComponentOverride>)

    Converts an entity to a ghost prefab, and registers it with the collection. This method will add the Prefab and LinkedEntityGroup components if they do not already exist. It will also add all component required for a prefab to be used as a ghost, and register it with the GhostCollectionSystem. The blob asset (which is created as part of making it a ghost prefab) is owned (and will be freed by) the GhostCollectionSystem. Thus, the calling code should not free the blob asset. The prefabs must be created exactly the same way on both the client and the server, and they must contain all components. Use component overrides if you want to have some components server or client only.

    Declaration
    public static void ConvertToGhostPrefab(EntityManager entityManager, Entity prefab, GhostPrefabCreation.Config config, NativeParallelHashMap<GhostPrefabCreation.Component, GhostPrefabCreation.ComponentOverride> overrides = default)
    Parameters
    Type Name Description
    EntityManager entityManager

    Used to add components data on ghost children.

    Entity prefab

    Entity prefab to be converted.

    GhostPrefabCreation.Config config

    Configuration used to create a ghost prefab.

    NativeParallelHashMap<GhostPrefabCreation.Component, GhostPrefabCreation.ComponentOverride> overrides

    Override types for specific components.

    Remarks

    Note that - when using this in a System OnCreate method - you must ensure your system is created after the DefaultVariantSystemGroup, as we must register serialization strategies before you access them.

    In This Article
    Back to top
    Copyright © 2023 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)