James Frowen

A collection of game development stuff.


How to use scripts and assets from variable-unity.dll

Contents

Scriptable objects and Game Variables

Create Scriptable object assets

Game Variables

Navigation

Navigation Controller

Menu Screen

Scene Details

Using Navigation Controller

Set Active Menu

Go To Previous Menu

Close Menu

Pop Up Menus

Load Scene

Scriptable objects and Game Variables

Create Scriptable object assets

Scriptable objects are custom assets, They act similarly to other scripts expect they are can not be attached to a GameObject.

Game Variables

These scriptable objects hold a single value and can be used for variables that need to be shared by multiple Objects

All of these variable assets have the same structure, they have a default value and the current value that can be changed at runtime

Variables can be reset to their default value using the “Reset” button or to reset all variables use the “Reset Scriptable Objects” in the tools menu

Navigation

Scriptable object for navigation

Navigation Controller

The Navigation controller can be used to open/close menus and load scenes. There should only be one Navigation controller in the project.

Menu Screen

Menu Screens hold a reference to prefabs for a menu, and must also have a reference to canvas they will be added to.

“Add To Menu Stack” allows other menus to go back to this menu (see Go To Previous Menu)

“Clear Menu Stack” removes all menus from the stack

Menu prefabs must have a “Menu Behaviour” script added to them

Scene Details

Scene Details hold information about a scene like their name and index in the project.

“Is Menu” indicates if the scene is a menu scene or a game scene. This can be used with a BoolVariable to conditionally load Objects.

“Scene Variables” is a list of Game Variables that should be reset when the scene loads. This can allow scenes to be reloaded in their initial state.

Using Navigation Controller

To use the Navigation controller, add an action to button event, set navigation controller a the Object, then select the function you want to use.

 

Set Active Menu

Use to open menus

Go To Previous Menu

Can can be used for a “back” button.

Close Menu

Closes the menu and clears the menu stack

Pop Up Menus

Opens a menu without closing the old one. Can be used to “are you sure” checks.

Load Scene