![]() |
Init(args)
Scripting Reference
|
A base class for a component that can specify the six arguments used to initialize an object of type TClient .
The arguments can be assigned using the inspector and are serialized as part of the client's scene or prefab asset.
The TClient client does not need to implement the IInitializable<TFirstArgument, TSecondArgument, TThirdArgument, TFourthArgument, TFifthArgument, TSixthArgument> interface. The initialization arguments can instead be injected, for example, directly into properties with public setters.
After the arguments have been injected the initializer is removed from the GameObject that holds it.
When you derive your initializer class from CustomInitializerBase<,,,,,,> you are responsible for implementing the argument properties and serializing their values. This means you will need to write a little bit more code, but it also grants you more options in how to handle the serialization, making it possible to support types that Unity can't serialize automatically. If you derive from CustomInitializer<,,,,,,> instead, then these things will be handled for you.
TClient | Type of the initialized client component. |
TFirstArgument | Type of the first argument to inject to the client. |
TSecondArgument | Type of the second argument to inject to the client. |
TThirdArgument | Type of the third argument to inject to the client. |
TFourthArgument | Type of the fourth argument to inject to the client. |
TFifthArgument | Type of the fifth argument to inject to the client. |
TSixthArgument | Type of the sixth argument to inject to the client. |
TClient | : | Component |
Protected Member Functions | |
void | InitTarget (TClient target, TFirstArgument firstArgument, TSecondArgument secondArgument, TThirdArgument thirdArgument, TFourthArgument fourthArgument, TFifthArgument fifthArgument, TSixthArgument sixthArgument) |
Initializes the target of type TClient using the provided arguments. | |
virtual void | OnReset (ref TFirstArgument firstArgument, ref TSecondArgument secondArgument, ref TThirdArgument thirdArgument, ref TFourthArgument fourthArgument, ref TFifthArgument fifthArgument, ref TSixthArgument sixthArgument) |
Resets the Init arguments to their default values. | |
Properties | |
TFirstArgument | FirstArgument [get, set] |
The first argument injected to the TClient client. | |
TSecondArgument | SecondArgument [get, set] |
The second argument injected to the TClient client. | |
TThirdArgument | ThirdArgument [get, set] |
The third argument injected to the TClient client. | |
TFourthArgument | FourthArgument [get, set] |
The fourth argument injected to the TClient client. | |
TFifthArgument | FifthArgument [get, set] |
The fifth argument injected to the TClient client. | |
TSixthArgument | SixthArgument [get, set] |
The sixth argument injected to the TClient client. | |
![]() | |
Object | Target [get, set] |
Existing target instance to initialize, if any. | |
bool | ProvidesCustomInitArguments [get] |
Gets a value indicating whether this initializer is able to provide custom per-instance Init arguments for its client. | |
Additional Inherited Members | |
![]() | |
new TClient | InitTarget () |
Initializes the client object of type TClient with the arguments specified by this initializer. | |
new System.Threading.Tasks.Task< TClient > | InitTargetAsync () |
Initializes the client object of type TClient asynchronously with the arguments specified by this initializer. | |
![]() | |
bool | TargetIsAssignableOrConvertibleToType (Type type) |
Gets a value indicating whether an object of the given type can be assigned to the Target property directly, or if type implements IValueProvider<T>, IValueByTypeProvider or IValueByTypeProviderAsync. | |