Player Rig & UI Prompts
NAMESPACEMyDreamGameStudio.InteractAnything
MENU PATHTutorials > Player & UI
COMPATIBILITYUnity 6.0+
DOC VERSION
This tutorial demonstrates how to equip a first-person player rig with the necessary sensors to interact with the world, alongside setting up dynamic Canvas UI prompts.
1. Player Camera & Raycasting
- Select your Player's Main Camera and add the
Raycast Interactorcomponent. - Adjust the ray distance (how far the player can reach) and set the Interaction Layer Mask to ensure it only hits valid interactable objects.
- Add the
Interaction Inputcomponent to your player rig. Configure your preferred key bindings, such as theEkey or Mouse Click, to trigger interactions.
2. Spatial Scanning
To allow the game to know what objects are nearby (for proximity outlines or floating UI markers), add the Nearby Interactables Scanner to the player character. Configure the detection radius using the sphere and angle filters to match the player's field of view.
3. UI Configuration
- Open your main Canvas hierarchy.
- Add the
Radius Finder UIcomponent, which maps world-space interactables to screen-space coordinates. - Assign your custom Interaction Marker prefab to the component.
- Add the
Interaction Prompt UIcomponent to handle text popups (e.g., "Press E to Open"). You can fully customize these UI markers and text panels to match your game's aesthetic.
4. Testing the Integration
Press Play and approach any interactable object in your scene. The customized UI prompt will dynamically appear on-screen. Press your configured interact key to watch the system successfully trigger the object's linked events.