// Use this for initialization void Start() { currentSmooth = smooth; sceneManager = GameObject.Find("SceneManager"); //the statement below automatically positions the camera behind the target. //hosMove = transform.position - target.transform.position; controllerPluggedIn controller = ControllerDetector.CheckController(); if (controller != controllerPluggedIn.noController) { controllerInput = true; } if (controllerInput) { Debug.Log("Xbox controller plugged in"); camRotateSpeed = controllerRotateSpeed; } else { Debug.Log("No controller plugged in"); camRotateSpeed = mouseRotateSpeed; } }
public static controllerPluggedIn CheckController() { controllerPluggedIn currentController = controllerPluggedIn.noController; string[] names = Input.GetJoystickNames(); for (int x = 0; x < names.Length; x++) { if (names[x].Length == 19) { currentController = controllerPluggedIn.PS4Controller; } if (names[x].Length == 33) { currentController = controllerPluggedIn.XBoxController; } } return(currentController); }