docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Method Destroy

    Destroy(NetworkObject)

    Invoked on Client and Server Once an implementation is registered with the NetworkPrefabHandler, this method will be called when a Network Prefab associated NetworkObject is:

    Server Side: destroyed or despawned with the destroy parameter equal to true If Despawn(bool) is invoked with the default destroy parameter (i.e. false) then this method will NOT be invoked!

    Client Side: destroyed when the client receives a destroy object message from the server or host.

    Note on Pooling: When this method is invoked, you do not need to destroy the NetworkObject as long as you want your pool to persist. The most common approach is to make the NetworkObject inactive by calling SetActive(bool).

    Declaration
    void Destroy(NetworkObject networkObject)
    Parameters
    Type Name Description
    NetworkObject networkObject

    The NetworkObject being destroyed

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