Quick Start Guide
Prerequisites
Before you begin, ensure your Unity project meets these requirements:
- Unity 6 (6000.0.32f1) or higher
- Input System package installed (com.unity.inputsystem v1.14.2+)
- Project Settings configured for Input System:
- Open
Edit > Project Settings > Player > Other Settings - Set
Active Input HandlingtoBothorInput System (New)
- Open
Step 1: Import PrestoPad
- Import PrestoPad from the Unity Asset Store
- Wait for Unity to compile the scripts
- Verify that the
com.unity.inputsystempackage is installed in Package Manager
Step 2: Add PrestoPad to Your Scene
- Drag the
PrestoPadManagerprefab into your scene- Location:
Assets/PrestoPad/Runtime/Prefabs/PrestoPadManager.prefab
- Location:
- Drag the
ConnectionDisplayprefab to show the QR code- Location:
Assets/PrestoPad/Runtime/Prefabs/ConnectionDisplay.prefab
- Location:
- Configure the server settings via the
PrestoPadServerConfigasset- Location:
Assets/PrestoPad/ScriptableObjects/PrestoPadServerConfig.asset
- Location:
Step 3: Configure Server Settings
Select the PrestoPadServerConfig asset and adjust these settings:
- HTTP Port: Default 8080 (serves the web controller interface)
- WebSocket Port: Default 8081 (handles real-time input)
- Max Connections: Maximum simultaneous controllers (1-12, default is 6)
- Enable Debug Logging: For development troubleshooting
Step 4: Set Up Input Actions
- Open your Input Actions asset (or create one via
Assets > Create > Input Actions) - Create actions for your game (Movement, Jump, Fire, etc.)
- Map your actions to work with the
PrestoPadControllerDevice- The device appears as
PrestoPadin the Input System - Available controls: ButtonA, ButtonB, ButtonX, ButtonY, StartButton, SelectButton, DPad, LeftStick
- The device appears as
- You can use any control scheme naming you prefer (no specific scheme is required)
Step 5: Test the Connection
- Enter Play Mode in Unity
- A QR code is displayed by the
ConnectionDisplayprefab - Scan the QR code with a smartphone on the same network
- The controller interface loads automatically in the phone browser
- Press buttons on your phone - you should see input in the Unity Editor!
Basic Code Example
Here's a simple script to handle controller input:
using UnityEngine;
using UnityEngine.InputSystem;
using PrestoPad.Input;
public class PlayerController : MonoBehaviour
{
private PrestoPadControllerDevice controller;
void Start()
{
// Listen for controller connection
InputSystem.onDeviceChange += OnDeviceChange;
}
void OnDeviceChange(InputDevice device, InputDeviceChange change)
{
if (device is PrestoPadControllerDevice pad)
{
if (change == InputDeviceChange.Added)
{
controller = pad;
Debug.Log($"Controller {pad.ControllerId} connected!");
}
}
}
void Update()
{
if (controller == null) return;
// Read button states
if (controller.ButtonA.wasPressedThisFrame)
Jump();
// Read joystick
Vector2 movement = controller.LeftStick.ReadValue();
Move(movement);
// Read D-Pad
if (controller.DPad.up.isPressed)
MoveUp();
}
void Jump() { /* Your jump logic */ }
void Move(Vector2 direction) { /* Your movement logic */ }
void MoveUp() { /* Your up movement logic */ }
}
Troubleshooting
QR Code Not Appearing
- Ensure
PrestoPadManageris in the scene - Check that
PrestoPadServerConfigis assigned - Verify the HTTP server started (check Console for logs)
Phone Can't Connect
- Ensure devices are on the same network
- Check firewall settings for ports 8080/8081
- Try using the displayed IP address directly in your phone's browser
- Disable VPN if active
Windows Firewall (Unity Editor)
When testing in the Unity Editor, you may need to add a firewall rule:
- Open Windows Defender Firewall with Advanced Security
- Click Inbound Rules → New Rule
- Select Program → Browse to
Unity.exe - Select Allow the connection
- Name: "Unity Editor - PrestoPad" → Finish
Next Steps
- Check out the Sample Scenes for complete examples
- Explore the API Reference for advanced features
- Customize the controller UI using the Theme Editor (
Tools > PrestoPad > Theme Editor)