![]() |
Init(args)
Scripting Reference
|
A base class for scriptable objects that can be created or instantiated with an argument passed to the Init method of the created instance.
If the object depends on a class that has the ServiceAttribute then it will receive it in its Init method automatically during initialization.
If the object depends on a class that doen't have the ServiceAttribute, then an ScriptableObjectInitializer<TScriptableObject, TArgument> can be used to specify its initialization argument.
Instances of classes inheriting from ScriptableObject<TArgument> receive the argument via the Init method where it can be assigned to a member field or property.
TArgument | Type of the argument received in the Init method. |
Protected Member Functions | |
void | Init (TArgument argument) |
Provides the ScriptableObject with the object that it depends on. | |
virtual void | OnReset () |
Reset state to default values. | |
virtual void | OnAwake () |
OnAwake is called when the script instance is being loaded during the Awake event after the Init method has finished. This happens as the game is launched and is similar to MonoBehavior.Awake. | |
virtual void | ValidateArgument (TArgument argument) |
Method that can be overridden and used to validate the initialization argument that was received by this object. | |
void | ThrowIfNull (TArgument argument) |
Checks if the argument is null and throws an ArgumentNullException if it is. | |
void | AssertNotNull (TArgument argument) |
Checks if the argument is null and logs an assertion message to the console if it is. | |
Properties | |
TArgument this[[DisallowNull] string | memberName [set] |
Assigns an argument received during initialization to a field or property by the memberName given name. | |
static NullExtensions.NullComparer | Null [get] |
A value against which any object can be compared to determine whether or not it is null or an Object which has been destroyed. | |
static NullExtensions.NullOrInactiveComparer | NullOrInactive [get] |
A value against which any object can be compared to determine whether or not it is null or an Object which is inactive or has been destroyed. | |
Additional Inherited Members | |
![]() | |
void | Validate (TArgument argument) |
Validates the initialization argument that was provided to this client. | |