Integrating InControl with Rex Engine

Introduction

 

InControl is a popular input manager asset for Unity. You can find its homepage here, and you can purchase it on the Unity Asset Store here.

It’s now fully integrated with Rex Engine, so users who have purchased both Rex Engine and InControl can use them together.

Here’s How To Integrate Them

  • Import the InControl asset into your Rex Engine project.
  • Under the RexEngine folder, open the “Integrations” folder, and unzip the “RexInControl” .zip file.

InControlRex_03

 

  • Find the Singletons prefab, under RexEngine > Resources > System > Singletons. Drag the Singletons prefab onto the stage.

InControlRex_01

 

  • Expand the Singletons prefab, and click on the InputManager GameObject in its children.

InControlRex_02

 

  • In the Inspector, remove the UnityInputManager component.
  • In RexEngine > Integrations > RexInControl, find InControlInputManager.cs. and drag this onto the InputManager GameObject.
  • Under the InControl files in InControl > Source > Components, find the InControlManager.cs file, and drag this onto the InputManager GameObject.

InControlRex_04

 

  • Hit “Apply” on the Singletons prefab, and delete it from the stage.
  • Go to Edit > ProjectSettings > InControl > Setup InputManager Settings.

InControl should now be working with Rex Engine! You can test this by connecting an InControl-compatible input device and testing your Rex Engine game.

Changing Inputs

 

You can change InControl’s inputs via the RexPlayerActionSet.cs class. If you open this script, you’ll see a list of actions and their corresponding buttons starting on line 41. For example, on lines 41, 42, and 43, you’ll see the following code:

playerActions.Jump.AddDefaultBinding( Key.Space );
playerActions.Jump.AddDefaultBinding( Key.H );
playerActions.Jump.AddDefaultBinding( InputControlType.Action1 );

This code binds the Jump action to the Space key, the H key, and InControl’s Action1 button, respectively. These can be edited to any buttons of your choosing. For more documentation on InControl’s button mappings, check out the InControl: Standardized Controls documentation.