-
-
Notifications
You must be signed in to change notification settings - Fork 0
Getting Started
This guide will consider that you have just followed the Installation Guide, and understand the basic concept of what InputLayres is meant to achieve as described here.
If you encounter any issues during installation, please feel free to ask for help before proceeding with this guide.
Before actually implementing anything, the first step of using InputLayers should be to plan out how you wish to make use of it.
In other words: how will you configure your layers and set their priorities according to your project's specific needs?
Here is an example of how to approach this question:
- Try to identify all the different UIs or components of your project that will need to react to user inputs.
- The goal is to ensure that each of these components should be the only one to receive inputs at all when it is active (aka. input exclusivity).
- In the case of UIs, this should include each popup, tab, panel, etc. as long as they are meant to receive input exclusivity.
- Other examples of components may include multiple characters that can be controlled separately, or switching between two control schemes for a given character/entity.
- Identify which ones will need to always take precedent (or "cover up") over others.
- These groups will become your Priorities.
- If you are unsure whether you need to make use of priorities, do not worry; you can easily rearrange layers down the line.
Each component will then require a uniquely named Layer placed into a specific Priorities level, as explained below; but first, we must prepare actual inputs using the built-in Unity system:
Preparing ActionMaps🔗
InputLayers is designed to make use of Unity's InputSystem🔗 regardless of how you wish to configure it. However, you will still need to use it to configure the actual inputs you wish to make use of before being able to assign them to InputLayers through the built-in UI.
This system is based around creating InputActionMaps🔗 that contain your input configurations; and though there are no set rules on how to best do this, here are a few things to keep in mind about using them with InputLayers:
- InputLayers is designed to let you use a single Action🔗 for a given input, and re-use it across multiple layers.
- So for example, if you use
Enter
/×
/□
for your "validation" input; you can configure it as a single Action🔗 that will be used foryes
/continue
/confirm
/next
across all of your UIs.
- So for example, if you use
- All Actions🔗 will automatically have their
Enable()
andDisable()
methods called by the InputLayers system; so you will not usually be handling this manually. - InputLayers uses Action🔗 names as a reference; so if you rename any; it may break your InputLayers configuration.
This could lead to having to manually reassign every LayeredAction you have configured in your project.
You are now ready to start setting up your Layers and Priorities!
In order to create and configure these, an editor window is made available in the dropdown menu at the top of Unity under Window/UI/InputLayers
:
This will open up the InputLayers configuration window:
Above is the default configuration for InputLayers. This configuration is designed for use in the included sample scenes. Unless you wish to explore these scenes to better understand how InputLayers can be used; you should now clear everything but the IL_ScriptableRefs
reference. and start configuring your own setup:
- In the following section, you should reference the ActionMaps🔗 that you have configured.
- You may reference however many you wish.
- In the
Layers
section, you should set up the number of PriorityLayers you wish to use by clicking the+
button in the bottom right: - Within a given PriorityLayer[IL_PriorityLayer], you can then add an InputLayer using the dedicated button:
- Name your layer:
- Important: each player must have a unique name.
A completed setup will look something like this (but probably with many more layers):
[WIP]
👉🏻 Download InputLayers on the Unity Asset Store!