Essential Systems
  • Welcome
  • Getting Started
    • Quickstart
    • ‼️Installation Guide
  • Systems
    • Object Pooling
    • Audio
    • Camera Shake
    • Console
    • Dialogue
    • Interface
    • Inputs
    • Proximity
    • Spawner
    • UI Components
    • Particles
    • Objects
    • Editor
    • Scenes
    • Utility
Powered by GitBook
On this page
  1. Systems

Interface

A game usually needs some interface or UI that is present almost everywhere. This is where the interface comes in handy.

PreviousDialogueNextInputs

Last updated 3 months ago

You must add the Interface <your input system> to the build settings. For example: if you're using the New Input System you add the Interface New to the build settings.

The interface is added to any scene using LoadScene(scene, LoadSceneMode.Additive). This will add the interface on top of the current activated scene.

This can be done a couple of different ways. For example; you can add a script to every scene where you want the interface to accessible that looks something like the following:

public class AddInterface : MonoBehaviour
{
    private void Start()
    {
        SceneManager.LoadScene("Interface", LoadSceneMode.Additive);
    }
}

Alternatively, we can have a static method that adds the interface whenever any scene is loaded:

public static class AddInterface
{
    [RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.BeforeSceneLoad)]
    private static void Init()
    {
        SceneManager.LoadScene("Interface", LoadSceneMode.Additive);
    }
}

In the interface we can add whatever UI logic we want. For example, as seen in the demo, we can add a Pause menu.