New game buttons not working

they were working but stopped all of a sudden not sure why heres the saving wrapper and main menu ui involving a new game

    public void NewGame(string saveFile)
    {
        if (!String.IsNullOrEmpty(saveFile)) return;
        SetCurrentSave(saveFile);
        StartCoroutine(LoadFirstScene());
    }


    private void SetCurrentSave(string saveFile)
    {
        PlayerPrefs.SetString(currentSaveKey, saveFile);
    }


    private IEnumerator LoadFirstScene()
    {
        Fader fader = FindObjectOfType<Fader>();
        yield return fader.FadeOut(fadeOutTime);
        yield return SceneManager.LoadSceneAsync(firstSceneBuildIndex);
        yield return fader.FadeIn(fadeInTime);
    }


    public void NewGame()
    {
        savingWrapper.value.NewGame(newGameNameField.text);

    }

EDIT : it works when i dont put any text

I think this is your culprit… the ! tells the compiler that you want to return if there IS a name, and continue if the string is null or empty.

i didnt event notice i put that there but that was exactly it, only other thing thats weird is mulitple new games dont show up in the load menu but thats a minimal issue rn it pretty much overwrites the last save in the load game menu

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms