Version: 2022.3

参数

disposing The flag to indicate whether the method call comes from a Dispose method or from a finalizer. A bool. When the value is true, the method call comes from a Dispose method. Otherwise, the method call comes from a finalizer.

描述

Disposes the view controller. Unity calls this method automatically when the view controller is no longer required, and its view will be removed from the window hierarchy.

Override this method to do any necessary clean up of your view controller, such as unsubscribing from events. You should always call the base implementation afterwards. You do not need to explicitly remove the view controller’s view from the hierarchy; Unity does this automatically when it disposes of the view controller.

For more information on the C# Dispose pattern, see Microsoft's documentation on Implementing dispose.

protected override void Dispose(bool disposing)
{
    if (disposing)
    {
        // Do any necessary clean up or freeing of managed resources.
    }

// Call the base implementation. base.Dispose(disposing); }
Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961