void OnEnable() { if (instance == null) { instance = this; if (dontDestroyOnLoad) { DontDestroyOnLoad(this); } } else if (this != instance) { isBeingDestroyed = true; //If destroying, we don't want to reset the InputManager Destroy(gameObject); } if (logDebugInfo) { Debug.Log("InControl (version " + InputManager.Version + ")"); Logger.OnLogMessage += HandleOnLogMessage; } InputManager.InvertYAxis = invertYAxis; InputManager.EnableXInput = enableXInput; InputManager.SetupInternal(); foreach (var className in customProfiles) { var classType = Type.GetType(className); if (classType == null) { Debug.LogError("Cannot find class for custom profile: " + className); } else { var customProfileInstance = Activator.CreateInstance(classType) as UnityInputDeviceProfile; InputManager.AttachDevice(new UnityInputDevice(customProfileInstance)); } } if (dontDestroyOnLoad) { DontDestroyOnLoad(this); } }
void OnEnable() { if (originalInstance != null && originalInstance != this) { //Remove the duplicate Destroy(this.gameObject); return; } originalInstance = this; if (logDebugInfo) { Debug.Log("InControl (version " + InputManager.Version + ")"); Logger.OnLogMessage += HandleOnLogMessage; } InputManager.InvertYAxis = invertYAxis; InputManager.EnableXInput = enableXInput; InputManager.SetupInternal(); foreach (var className in customProfiles) { var classType = Type.GetType(className); if (classType == null) { Debug.LogError("Cannot find class for custom profile: " + className); } else { var customProfileInstance = Activator.CreateInstance(classType) as UnityInputDeviceProfile; InputManager.AttachDevice(new UnityInputDevice(customProfileInstance)); } } if (dontDestroyOnLoad) { DontDestroyOnLoad(this); } }
public InputManager( Input.Factory inputFactory, InControl.InControlManager inControlManager) { this.inputFactory = inputFactory; }
void OnEnable() { if (instance == null) { instance = this; if (dontDestroyOnLoad) { DontDestroyOnLoad(this); } } else if (this != instance) { isBeingDestroyed = true; //If destroying, we don't want to reset the InputManager Destroy(gameObject); } if (logDebugInfo) { Debug.Log( "InControl (version " + InputManager.Version + ")" ); Logger.OnLogMessage += HandleOnLogMessage; } InputManager.InvertYAxis = invertYAxis; InputManager.EnableXInput = enableXInput; InputManager.SetupInternal(); foreach (var className in customProfiles) { var classType = Type.GetType( className ); if (classType == null) { Debug.LogError( "Cannot find class for custom profile: " + className ); } else { var customProfileInstance = Activator.CreateInstance( classType ) as UnityInputDeviceProfile; InputManager.AttachDevice( new UnityInputDevice( customProfileInstance ) ); } } if (dontDestroyOnLoad) { DontDestroyOnLoad( this ); } }
// Use this for initialization void Start() { manager = GetComponent <InControl.InControlManager>(); }