DisposeGameObject Method
- Namespace
- SatorImaging.UnityFundamentals
DisposeGameObject<T>(ref T, float)
public static void DisposeGameObject<T>(ref T component, float t = 0) where T : Component
This method ensures variable doesn't have reference to deleted component. Especially useful when destroying GameObject by Transform reference.
Parameters
component
Tt
float
Type Parameters
T
Remarks
Shorthand for Destroy(component.gameObject); component = null;
DisposeGameObject<T>(ref T?[], float)
public static void DisposeGameObject<T>(ref T?[] array, float t = 0) where T : Component
Dispose objects in collection and collection together.
Parameters
array
T[]t
float
Type Parameters
T
DisposeGameObject<T>(T?[], float)
public static void DisposeGameObject<T>(T?[] array, float t = 0) where T : Component
For readonly collection to dispose only elements.
Use ref overload instead to dispose elements and collection together.
Parameters
array
T[]t
float
Type Parameters
T
DisposeGameObject<T>(ref List<T?>, float)
public static void DisposeGameObject<T>(ref List<T?> list, float t = 0) where T : Component
Dispose objects in collection and collection together.
Parameters
Type Parameters
T
DisposeGameObject<T>(List<T?>, float)
public static void DisposeGameObject<T>(List<T?> list, float t = 0) where T : Component
For readonly collection to dispose only elements.
Use ref overload instead to dispose elements and collection together.
Parameters
Type Parameters
T
DisposeGameObject<T>(ref ICollection<T?>, float)
public static void DisposeGameObject<T>(ref ICollection<T?> collection, float t = 0) where T : Component
Dispose objects in collection and collection together.
Parameters
collection
ICollection<T>t
float
Type Parameters
T
DisposeGameObject<T>(ICollection<T?>, float)
public static void DisposeGameObject<T>(ICollection<T?> collection, float t = 0) where T : Component
For readonly collection to dispose only elements.
Use ref overload instead to dispose elements and collection together.
Parameters
collection
ICollection<T>t
float
Type Parameters
T
DisposeGameObject<TKey, TValue>(ref IDictionary<TKey, TValue?>, float)
public static void DisposeGameObject<TKey, TValue>(ref IDictionary<TKey, TValue?> dict, float t = 0)
Dispose objects in collection and collection together.
Parameters
dict
IDictionary<TKey, TValue>t
float
Type Parameters
TKey
TValue
Remarks
Dispose()
will be called if TKey
and/or TValue
implements IDisposable.
DisposeGameObject<TKey, TValue>(IDictionary<TKey, TValue?>, float)
public static void DisposeGameObject<TKey, TValue>(IDictionary<TKey, TValue?> dict, float t = 0)
For readonly collection to dispose only elements.
Use ref overload instead to dispose elements and collection together.
Parameters
dict
IDictionary<TKey, TValue>t
float
Type Parameters
TKey
TValue
Remarks
Dispose()
will be called if TKey
and/or TValue
implements IDisposable.