Table of Contents

Managed Shell Disposer

Runtime/UnityObject/ManagedShell.cs   HeaderDoc

(c) 2024 Sator Imaging, Licensed under the MIT License https://github.com/sator-imaging/Unity-Fundamentals

Provides utility methods to avoid creating leaked managed shells.

HOW TO USE

// dispose an object.
ManagedShell.Dispose(ref unityObj);

// dispose objects in collection and collection together.
ManagedShell.Dispose(ref Array_or_Collection);

// dispose objects in collection only. collection keeps alive.
ManagedShell.Dispose(ReadOnly_Array_or_Collection);

// component disposer which is useful when dispose gameObject by transform reference.
// ie) shorthand for `Destroy(component.gameObject); component = null;`
void DisposeGameObject<T>(ref T component) where T : UnityEngine.Component

// same manner with Dispose() methods.
ManagedShell.DisposeGameObject(ref component);
ManagedShell.DisposeGameObject(ref componentArrayOrCollection);
ManagedShell.DisposeGameObject(readonlyComponentCollection);