public static void SetDifficulty(string name) { foreach (GamePlayConstants gameplayConstants in gameplayConstantsCollection) { if (gameplayConstants.difficultyName == name) { Debug.Log("Set the GamePlayConstants to " + name); instance = gameplayConstants; return; } } }
void DropdownValueChanged(Dropdown dropdown) { //string difficultyName = change.value as string; string difficultyName = GamePlayConstants.Difficulties[dropdown.value]; if (difficultyName != null) { GamePlayConstants.SetDifficulty(difficultyName); } else { Debug.LogWarning("The dropdown value is not a string"); } }