[ Web Proxy ]
URL:
Viewing: https://docs.unity3d.com/ScriptReference/GameObject.IsDestroying.html [Back]  [Original]

Unity - Scripting API: GameObject.IsDestroying
Version: Unity 6.5 (6000.5)
    • Supported
    • Legacy
    LanguageEnglish
    • C#

    GameObject.IsDestroying

    Suggest a change

    Success!

    Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

    Close

    Submission failed

    For some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

    Close
    Your name Your email Suggestion* Submit suggestion

    Cancel

    Switch to Manual

    Declaration

    public bool IsDestroying();

    Returns

    bool Is this GameObject being destroyed.

    Description

    Checks if the GameObject and its descendants are currently in the process of being destroyed.

    This function is only needed in the OnDestroy() lifetime callbacks for MonoBehaviours. For example if you need to instantiate a GameObject in an OnDestroy() callback under a specific parent GameObject, you will need to check if that parent GameObject is also in process of being destroyed before using it as a parent. Additional resources: MonoBehaviour.OnDestroy.


    Web Proxy Viewer  |  New URL  |  Original Page