docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Struct GhostCollectionCleanupSystem

    Disabled system that exists to cleanup persistently allocated state in a temp baking world. This will properly dispose of allocations inside any orphan CodeGhostPrefab blobs.

    Implements
    ISystem
    Inherited Members
    ValueType.Equals(object)
    ValueType.GetHashCode()
    object.Equals(object, object)
    object.GetType()
    object.ReferenceEquals(object, object)
    Namespace: Unity.Netcode
    Assembly: Unity.NetCode.dll
    Syntax
    [BurstCompile]
    public struct GhostCollectionCleanupSystem : ISystem
    Remarks

    We use temp baking worlds in a few places that never create the GhostCollectionSystem. ConvertToGhostPrefab(EntityManager, Entity, Config, NativeParallelHashMap<Component, ComponentOverride>) makes a persistent allocation as it bakes a prefab. Normally, OnDestroy(ref SystemState) cleans up those allocations, but if we have a world without a GhostCollectionSystem, the persistant allocations causes memory leaks.

    Methods

    OnCreate(ref SystemState)

    Declaration
    public void OnCreate(ref SystemState state)
    Parameters
    Type Name Description
    SystemState state

    OnDestroy(ref SystemState)

    Declaration
    public void OnDestroy(ref SystemState state)
    Parameters
    Type Name Description
    SystemState state

    Implements

    ISystem
    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)