Scriptable Objects

This page presents functionalities provided by Grail Unity Plugin’s scriptable objects.

Internal Scriptable Objects

Those scriptable objects do not need to be overriden. User can create instances of those objects by right-clicking on project view and selecting CreateGrail<name_of_scriptable_object>.

Grail Configuration Loader

Scriptable object responsible for loading Grail config file and storing its data. The user chooses which file this object should be responsible for and then provides it with ReasonerFactories and/or behavior and consideration repositories so it will be able to instantiate default factory producing UtilityReasoners.

Exemplar GrailConfigurationLoader inspector

Behavior Repository

Set of all available BehaviorProviders associated with at least one configuration file. User can use one monolithic BehaviorRepository for all behaviors from multiple configuration files or use one repository per file. Nevertheless, each BehaviorRepository must contain all BehaviorProviders defined in given file.

Exemplar BehaviorRepository inspector

Consideration Repository

Set of all available ConsiderationProviders associated with at least one configuration file. User can use one monolithic ConsiderationRepository for all considerations from multiple configuration files or user one repository per file. Nevertheless, each ConsiderationRepository must constain all ConsiderationProviders defined in given file.

Exemplar ConsiderationRepository inspector

User-defined Scriptable Objects

Those scriptable objects need to be overriden by the user. The user should also give their derived classes an attribute CreateAssetMenu so it will be later possible to create instance of those scriptable objects.

BehaviorProvider

This scriptable object is an abstract class from which the user should inherit when making use of Grail’s internal Utility System. The user needs to override InstantiateBlueprint method, which should return a Blueprint able to provide instance of the desired type of Behavior.

When constructing Blueprint, remember to pass it a name identical to the one defined in Grail config file you intend to use. It is advised to use parent class member variable behaviorName and fill it in this scriptable object inspector view.
Exemplar BehaviorProvider inspector

Consideration Provider

This scriptable object is an abstract class from which the user should inherit when making use of Grail’s internal Utility System. User needs to override InstantiateConsideration method, which should return a Consideration defining subset of current game state.

Remember to set ConsiderationProvider’s name to be identical with the one defined in Grail config file you intend to use.
Exemplar ConsiderationProvider inspector

Reasoner Factory

It is a scriptable object user should inherit from whenever they want to use reasoner other than UtilityReasoner and pass it to GrailConfigurationLoader. It requires user to override CreateReasoner method which should return Reasoner appropriate for a given identificator.