|
Init(args)
Scripting Reference
|
A base class for MonoBehaviours that act as simple wrappers for plain old class objects.
A class wrapped by the Wrapper<> component can be added to a GameObject using the AddComponentExtensions.AddComponent<TWrapper, TWrapped>(GameObject, TWrapped) method.
Optionally the wrapped class can receive callbacks during select unity event functions from the wrapper by implementing one or more of the following interfaces:
The wrapped object can start coroutines running on the wrapper component by implementing ICoroutines and then using ICoroutineRunner.StartCoroutine.
| TWrapped | Type of the plain old class object wrapped by this component. |
Static Public Member Functions | |
| static implicit | operator TWrapped (Wrapper< TWrapped > wrapper) |
| Defines an implicit conversion of a Wrapper<TWrapped> to the TWrapped plain old class object that it wraps. | |
| static | operator Wrapper< TWrapped > (TWrapped wrapped) |
| Defines an explicit conversion of a TWrapped to a Wrapper<TWrapped> component that wraps it. | |
Protected Member Functions | |
| virtual void | OnReset (ref TWrapped wrapped) |
| Resets the wrapped object to its default value. | |
| virtual void | Awake () |
| Awake is called when the script instance is being loaded and handles calling the Init method with the TWrapped argument. | |
| virtual void | OnEnable () |
| This function is called when the object becomes enabled and active. | |
| virtual void | Start () |
| Start is called on the frame when a script is enabled just before any of the Update methods are called the first time. | |
| virtual void | OnDisable () |
| This function is called when the behaviour becomes disabled. | |
| virtual async void | OnDestroy () |
| The OnDestroy even function is called when this Wrapper or the GameObject to which it is attached is destroyed, or the scene which the GameObject is part of is unloaded. | |
Protected Member Functions inherited from Sisus.Init.Wrapper | |
| object | GetWrappedObject () |
| Gets the plain old class object wrapped by this component. | |
Properties | |
| new TWrapped | WrappedObject [get] |
| The plain old class object wrapped by this component. | |
Properties inherited from Sisus.Init.Wrapper | |
| object | WrappedObject [get] |
| Gets the plain old class object wrapped by this component. | |
Properties inherited from Sisus.Init.IWrapper | |
| GameObject | gameObject [get] |
| The GameObject this wrapper is attached to, if any. | |
| HideFlags | hideFlags [get, set] |
| Should the object be hidden, saved with the Scene or modifiable by the user? | |
| string | name [get, set] |
| The name of the object. | |
| bool | isActiveAndEnabled [get] |
Gets a value indicating whether the wrapper is enabled and not attached to an inactive
. | |
Additional Inherited Members | |
Public Member Functions inherited from Sisus.Init.IWrapper | |
| int | GetInstanceID () |
| Returns the instance id of the object. | |
| bool | CompareTag (string tag) |
Returns true if the wrapper is attached to a GameObject that has the given tag; otherwise, false. | |
| T | Find< T > () |
| Gets a reference to an object of type T found on the GameObject the wrapper is attached to. | |
| T[] | FindAll< T > () |
| Gets references to all objects of type T found on the GameObject the wrapper is attached to. | |
| T | FindInChildren< T > () |
| Gets a reference to an object of type T found on the GameObject the wrapper is attached to, or any of its children. | |
| T[] | FindAllInChildren< T > () |
| Gets references to all objects of type T found on the GameObject the wrapper is attached to, or any of its children. | |
| T | FindInParents< T > () |
| Gets a reference to an object of type T found on the GameObject the wrapper is attached to, or any of its parents. | |
| T[] | FindAllInParents< T > () |
| Gets references to all objects of type T found on the GameObject the wrapper is attached to, or any of its parents. | |
Public Member Functions inherited from Sisus.Init.ICoroutineRunner | |
| Coroutine | StartCoroutine (IEnumerator coroutine) |
| Starts the provided coroutine . | |
| void | StopCoroutine (IEnumerator coroutine) |
| Stops the provided coroutine . | |
| void | StopCoroutine (Coroutine coroutine) |
| Stops the provided coroutine . | |
| void | StopAllCoroutines () |
Stops all coroutine coroutines that are currently running on this object, if any. | |
Public Member Functions inherited from Sisus.Init.IValueByTypeProvider | |
| bool | TryGetFor ([AllowNull] Component client, [DisallowNull] Type valueType, out object value) |
| Gets the value of the given type for the client . | |
| bool | HasValueFor< TValue > (Component client) |
| Gets a value indicating whether this value provider can provide a value of type TValue for the client at this time. | |
Public Member Functions inherited from Sisus.Init.IInitializable< TArgument > | |
| void | Init (TArgument argument) |
| Initializes the object with an object that it depends on. | |
Public Member Functions inherited from Sisus.Init.IArgs< TArgument > | |
| void | Validate (TArgument argument) |
| Validates the initialization argument that was provided to this client. | |
Public Member Functions inherited from Sisus.Init.IValueProvider< TValue > | |
| new bool | HasValueFor (Component client) |
| Gets a value indicating whether this value provider can provide a value of type TValue for the client at this time. | |
| bool | TryGetFor ([AllowNull] Component client, [NotNullWhen(true), MaybeNullWhen(false)] out TValue value) |
| Gets the value of type TValue for the client . | |