Quick Start
This guide covers the absolute minimum requirements to get a functional interaction running in your scene without writing a single line of code. We will set up the global input router, equip your player camera with a sensor, and make a standard 3D cube interactive.
Step 1: The Global Input Manager
The framework uses a centralized hardware router so individual sensors don't have to poll for input independently.
- Create a new Empty GameObject in your scene and name it
Interaction Manager. - Add the Interaction Input component (
Interaction System > Core > Interaction Input). - Leave the settings at their defaults. It will automatically listen for the
Ekey (or left mouse click) and route it to whatever interactor is currently active.
Step 2: The Player Sensor (Interactor)
Your player needs a way to detect interactive objects in the world. For a standard First-Person or Third-Person setup, we use a Raycast.
- Select your player's Main Camera in the hierarchy.
- Add the Raycast Interactor component (
Interaction System > Interactors > Raycast Interactor). - By default, it will automatically use the camera it is attached to and cast a ray forward into the center of the screen. You can adjust the
Ray Distanceif you want a longer or shorter reach.
(Note: If you are building a top-down or point-and-click game, use the Cursor Interactor instead, which projects a ray from the mouse position.)
Step 3: The Target Object (Interactable)
Now we need something to actually interact with. The Interactable component acts as the brain for the object, handling states like Instant, Hold, and Toggle.
- Go to GameObject > 3D Object > Cube to create a basic cube in front of your camera.
- Add the Interactable component (
Interaction System > Core > Interactable). - In the Inspector, locate the Prompt Text field and change it from "Interact" to "Destroy Cube".
- Scroll down to the Core Events section.
- Click the
+button under On Interaction Complete. - Drag the Cube GameObject itself into the object slot, click the dropdown, and select
GameObject.SetActive. Ensure the checkbox is unchecked (false).
Step 4: The Visual Prompt (Optional but Recommended)
To see the "Destroy Cube" text pop up when you look at the object, we need to add the UI renderer.
- Go to GameObject > UI > Canvas to create a new UI Canvas.
- Inside the Canvas, create an Empty GameObject named
Prompt Panel. - Inside the
Prompt Panel, create a UI > Text - TextMeshPro object. - Select the Canvas and add the Interaction Prompt UI component (
Interaction System > UI > Interaction Prompt UI). - Assign your Main Camera to the
UI Cameraslot. - Assign the
Prompt Panelto thePanelslot, and your TextMeshPro object to thePrompt Textslot.
Play!
Press Play in the Unity Editor. When you look at the Cube, the Raycast Interactor will detect it and the UI will snap to the cube's position displaying "Destroy Cube". Press the E key, and the cube will instantly deactivate.