WeatherMakerScriptFindOrCreateInstanceT Method |
Find or create a singleton object. In OnDestroy, you must call ReleaseInstance to avoid memory leaks.
Namespace:
DigitalRuby.WeatherMaker
Assembly:
Assembly-CSharp (in Assembly-CSharp.dll) Version: 0.0.0.0
Syntax public static T FindOrCreateInstance<T>(
ref T instance,
bool required = false
)
where T : MonoBehaviour
Public Shared Function FindOrCreateInstance(Of T As MonoBehaviour) (
ByRef instance As T,
Optional required As Boolean = false
) As T
public:
generic<typename T>
where T : MonoBehaviour
static T FindOrCreateInstance(
T% instance,
bool required = false
)
static member FindOrCreateInstance :
instance : 'T byref *
?required : bool
(* Defaults:
let _required = defaultArg required false
*)
-> 'T when 'T : MonoBehaviour
Parameters
- instance
- Type: T
Singleton instance variable - required (Optional)
- Type: SystemBoolean
Whether the instance is required
Type Parameters
- T
- Type of object
Return Value
Type:
TResult, can be null
See Also