/// <summary> /// Changes the active input configuration. /// </summary> public static void SetInputConfiguration(string name, PlayerID playerID) { PlayerID?playerWhoUsesInputConfig = _instance.IsInputConfigurationInUse(name); if (playerWhoUsesInputConfig.HasValue && playerWhoUsesInputConfig.Value != playerID) { Debug.LogErrorFormat("The input configuration named \'{0}\' is already being used by player {1}", name, playerWhoUsesInputConfig.Value.ToString()); return; } if (playerWhoUsesInputConfig.HasValue && playerWhoUsesInputConfig.Value == playerID) { return; } InputConfiguration inputConfig = null; if (_instance._configurationTable.TryGetValue(name, out inputConfig)) { _instance.SetInputConfigurationByPlayerID(playerID, inputConfig); ResetInputConfiguration(playerID); _instance.RaiseInputConfigurationChangedEvent(playerID); } else { Debug.LogError(string.Format("An input configuration named \'{0}\' does not exist", name)); } }
/// <summary> /// Changes the active input configuration. /// </summary> public static void SetInputConfiguration(string name) { if (_instance._currentConfiguration != null && name == _instance._currentConfiguration.name) { return; } if (_instance._configurationTable.TryGetValue(name, out _instance._currentConfiguration)) { ResetInputAxes(); _instance.RaiseInputConfigurationChangedEvent(name); } else { throw new ArgumentException(string.Format("An input configuration named \'{0}\' does not exist", name)); } }