Skip to content

New_Prefabs

Jack Brett edited this page Jun 17, 2024 · 1 revision

The typical architecture of the LUTE system is that Nodes drive the main behaviour of the game in which a list of Orders drive the individual functionality of the Nodes. When Orders are called, they themselves rarely contain all the functionality of the behaviour and are separated into other objects and classes.

For example, the Dialogue Order pertains all information and parameters that relate to the Order but the Order simply creates or finds the Dialogue prefab in the scene then passes the control and behaviour over to this specific object with the parameters that have been supplied by the Order.

var dialogueBox = DialogueBox.GetDialogueBox();

This static method contained on DialogueBox is similar to other methods in which the class will search for exisiting spawned objects of a particular type then use the first one if found or spawn a new one from the prefabs folder if not:

GameObject prefab = Resources.Load<GameObject>("Prefabs/DialogueBox");

We suggest following this workflow of Orders and prefabs to keep logic separate and easy to understand.

Duplicating Existing Prefabs

You may find yourself wanting to use specific Orders but the prefabs they make use of could be not to your taste (in terms of design and behaviour). If it is simply the design then you could duplicate the prefab, modify the look and then delete the original or ensure that this specific prefab is referred to in the Order itself (for example, this can be done in the Choice Order):

choiceOrder.

Extending the behaviour of the prefab could be as simple as duplicating it then adding a custom script to it or you may wish to modify the behaviour entirely. You could either inherit from the base prefab class (such as inherting from the DialogueBox class) or writing a brand new script for it.

In the latter (writing a new script) you will likely need to create a new Order for this (you could copy the original) as the original Order will not recognise the new class that is looking for.

Clone this wiki locally