Programming Guide
Modoium enables you use mobile inputs directly in the Unity Editor by simulating input devices based on input events transmitted over the network from the connected mobile device. We are working hard to fully simulate these input devices behind the scenes. However, depending on the libraries you use, there are some instructions required to make the most of all Modoium features.
Input
Unity provides two methods of implementing input : Input System and built-in UnityEngine.Input
class. We strongly recommend using the Input System as Modoium integrates seamlessly with it; however, you can still reference UnityEngine.Input
in a limited way.
Input System
Modoium operates entirely behind the scenes, thanks to the Input System’s flexible structure for managing input devices. All supported InputDevice
s of the connected mobile device are available in the editor, allowing you to safely ignore mouse input when managing input bindings for testing in the editor.
- Supported Device Inputs
Touchscreen
Keyboard
:Key.Escape
for Android Back button
Built-in UnityEngine.Input
class
Modoium cannot seamlessly simulate input devices due to limitations in Unity’s built-in Input module. You MUST use Modoium.Service.Input
instead of UnityEngine.Input
to handle input events from the connected mobile device. Replace all references to UnityEngine.Input
with Modoium.Service.Input
, or simply add the following statement at the top of your input processing script files.
using Input = Modoium.Service.Input;
- Supported APIs
namespace Modoium.Service {
class Input {
static bool touchSupported;
static bool touchPressureSupported;
static bool multiTouchEnabled;
static bool touchCount;
static Touch GetTouch(int index);
// KeyCode.Escape for Android Back button
static bool GetKey(KeyCode key);
static bool GetKeyUp(KeyCode key);
static bool GetKeyDown(KeyCode key);
// Note: Modoium.Service.Input simply redirects other APIs to UnityEngine.Input.
}
}
If
UnityEngine.EventSystems.EventSystem
uses any built-inUnityEngine.Input
-based input module, Modoium attempts to override its input withModoium.Service.Input
. Be cautious if you are implementing your own input overrides.
Project Settings
You can configure various behaviors of Modoium Remote in the Project Settings.
- Simulate Touch With Mouse : When enabled, Modoium simulates the mouse as an additional touch.
- Enable Android Back Button Input : When enabled, the Android Back button functions as the Escape key during play, instead of disconnecting the connection from the Modoium app.
Build
All features in the Modoium Remote Unity package work exclusively in the editor and have no impact on the built app, so you can build your project without concern while Modoium Remote is installed.