Quick Start Guide
Unlock the full potential of your Unity games with the Eidolon.Controller
package. Seamlessly integrate game controller input and elevate your gaming experience to new heights. Explore the comprehensive features below to master controller input management like a pro.
1. Detect Connected Controllers
Discover connected game controllers and initialize button mappings for PlayStation, Xbox, or generic controllers with ease.
// Detect connected controllersbool anyControllerConnected = Controller.DetectConnectedController();
2. Get Button Input Names
Retrieve the input name for a specific button on the connected controller for seamless interaction.
// Get input name for the "Cross" button on PlayStation controllerstring crossButtonInput = Controller.GetButtonName("Cross");
3. Input Mapping Made Easy
Check for controller specific input to make adding controller support a ton easier!
// Playstationif (Input.GetKey(PlayStation.Circle)){ Debug.Log($"Playstation Mapping: {PlayStation.Circle} Pressed!");}
// Xboxif (Input.GetKey(Xbox.A)){ Debug.Log($"Xbox Mapping: {Xbox.A} Pressed!");}
// Generic controllersif (Input.GetKey(Generic.Start)){ Debug.Log($"Generic Mapping: {Generic.Start} Pressed!");}
3. Example Usage
Dive into an immersive gaming experience with the following example script:
using UnityEngine;using Eidolon.Controller;
public class ControllerExample : MonoBehaviour{ void Start() { // Detect connected controller bool controllerDetected = Controller.DetectConnectedController();
if (controllerDetected) { Debug.Log("Controller detected! Get ready for immersive gameplay!");
// Example of getting Unity Input ID based on mapped button name string crossButtonName = Controller.GetButtonName("Cross"); string circleButtonName = Controller.GetButtonName("Circle"); string squareButtonName = Controller.GetButtonName("Square"); string triangleButtonName = Controller.GetButtonName("Triangle");
// Display mapped button names for user reference Debug.Log($"Cross button mapped to: {crossButtonName}"); Debug.Log($"Circle button mapped to: {circleButtonName}"); Debug.Log($"Square button mapped to: {squareButtonName}"); Debug.Log($"Triangle button mapped to: {triangleButtonName}"); } else { Debug.Log("No controller detected. Connect a controller for an enhanced gaming experience!"); } }
private void Update() { // Alternatively, check for input the usual way if (Controller.DetectConnectedController()) { // Playstation if (Input.GetKey(PlayStation.Circle)) { Debug.Log($"Playstation Mapping: {PlayStation.Circle} Pressed!"); } // Xbox if (Input.GetKey(Xbox.A)) { Debug.Log($"Xbox Mapping: {Xbox.A} Pressed!"); } // Generic controllers if (Input.GetKey(Generic.Start)) { Debug.Log($"Generic Mapping: {Generic.Start} Pressed!"); } }
}}