WHAT’S THIS? #
The Touch Interface Subsystem is a Local Player Subsystem which is automatically created and associated to each player (ULocalPlayer). This subsystem will allow you to add the touch interface with desired layout for each player. Therefore, touch interface designer is ready for multiplayer!
It contains a number of useful functions, such as displaying or hiding the touch interface, getting the layout instance or transforming an absolute position into a local position.
HOW DO I ACCESS THE SUBSYSTEM? #
In Blueprint

Right click to bring up the context menu and type Layout. You should see two entries.
In some cases, the context can be resolved automatically, for example if you’re in the player controller class (APlayerController).

If you’re in a pawn class (APawn) or one derived from it (ACharacter, for example), you’ll need to retrieve the controller instance and cast it to the PlayerController class. This will enable you to retrieve the subsystem associated with the player in the case of a multiplayer game (local or online).

If you’re in a class other than a pawn, or if your game/application contains no multiplayer elements, you may need to retrieve the player controller instance directly by specifying the player index. Work in local multiplayer.

In C++
Inside Pawn or derived class (work in online multiplayer)

Inside Player Controller class

Inside other class. Be careful with player index.

TOUCH INTERFACE #
Add Touch Interface
To add a touch interface, you must use the Add Touch Interface node and specify the Touch Interface Layout asset that you want to apply to the touch interface. The touch interface is added to the player’s screen, not the viewport, to ensure compatibility with local multiplayer.

Remove
To remove the touch interface from the player’s screen, simply select Remove Touch Interface. Warning! This permanently removes the touch interface.
You must ensure the touch interface is removed before changing levels, otherwise you may receive error messages from the engine. To assist with this, the subsystem can automatically remove the touch interface before a level loads. To enable this, in the plugin settings, check Automatically Remove On Level Load.
Get Instance
If needed, you can retrieve the instance of the Touch Interface Layout that was created when you added the touch interface to the player’s screen.
Why retrieve the instance instead of editing the asset directly?
If you edit the asset directly, the one located in the content browser, all changes made will be reflected in the editor. This is not the intended behavior. Imagine that at runtime, you delete several components; once in the editor, these components will have been effectively destroyed and you will no longer be able to recover them. This can also cause malfunctions and crashes.
In future plugin updates, I will add additional safeguards to prevent you from making the mistake of modifying the asset.
VISIBILITY #
You might need to display a menu and hide the touch interface to avoid user confusion and unwanted movements or actions. You can show or hide the touch interface using the Show Touch Interface or Hide Touch Interface nodes. You can check if the interface is visible using Is Visible. Also, you can register a function for the On Visibility State Changed event.
DRAWER #
If you are using drawing recognition, you can display what the user is drawing using the Virtual Shape Drawer Class. More information about this feature is available here. To do this, use the Add Drawer node and specify the class to use. A dedicated drawing widget will be added on top of the touch interface. This widget doesn’t retrieve inputs, that’s handled by the Shape Recognizer component. The ZOrder is used solely for rendering priority.
From the subsystem, you can retrieve the drawer instance, display it, hide it, and delete it.
INPUT #
You can enable or disable interactions with the touch interface using the Enable Input or Disable Input node. Note that this will prevent the recognition systems from working.
Shape Recognizer
You can force the recognizers to start shape detection with the Try Recognize Shape function. This is a global call, you can call Try Recognize Shape on each Shape Recognizer. For now, DO NOT CALL this function until the user has finished drawing.
UTILITY
The subsystem contains useful functions for converting positions in different spaces, for checking the state of the touch interface, etc.
SAVE & LOAD
Touch Interface Designer integrates a save system that allows you to save the state of the touch interface and restore this state when launching the application/game or whenever you deem it necessary. Currently, only the position and size of the components are saved, but improvements in future updates will allow you to save much more.
Save
To save the state of the touch interface, you can create a snapshot using the Save function. You must specify the Touch Interface Layout you are saving (the asset, not instance) and enter an ID for the snapshot. This ID will be required for loading or other operations related to the save system.

Load
To restore the touch interface state from a snapshot, you have two different methods. Either you specify that you want to restore the touch interface state to its creation. This is a boolean value to check in the Add Touch Interface node. Or you apply the snapshot later using the Apply Snapshot function. In both cases, the snapshot ID will be requested. Note that it is your responsibility to verify that the saved state corresponds to the layout you are currently using. Future updates will improve the save system to make it simpler and safer to use.

More informations in this article
EVENTS #
The subsystem monitors the state of the touch interface and sends events when it is created, destroyed, displayed, hidden, etc. You can register one or more functions to these events if needed.
How to register function?


