"DontDestroyOnLoad" Object: Troubles with modifying associated variables

Hello, I’ve created an object+script named “DayManager”. This object also has a script named “RemainOnLoad”, which contains the following code:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class RemainOnLoad : MonoBehaviour {

    public static RemainOnLoad instance;

    void Start() {

        if (instance == null) {
            instance = this;
            DontDestroyOnLoad(gameObject);
        } else if (instance != this)
            Destroy(gameObject);
       
    }
}

The idea is that the object persists throughout scenes, and when returning to the original scene, there are no duplicates of the object. This works as intended.

Now, within my “DayManager” script, I’ve turned it into an accessible script by using “public static ScriptName instance”. This also works as intended.

My issue comes up in the following situation: At the end of an in-game day, the game loads a new scene. From that second scene, there is a button that if clicked will return the player back to the first scene. (This second scene has other options as well, it does have a purpose.). Right before the first scene is reloaded, an int named “currentDay” is increased by one (currentDay++). This works, the first time. Once the first scene has been reloaded, and the new “Day” has ended, going through the end of day stuff, switching to a different scene and then back, for some reason does not cause the currentDay variable to increase anymore.

Could this be because the variable is for some reason resetting everytime the first scene is reloaded? (Even though there are no duplicates of the DayManager object)

Any help would be very much appreciated. I’ve included the relevant scripts below.

The button that returns the player to the first scene contains the following code:

public void EndDayButton () {

        DayManager.instance.BeginNewDay();

    }

My entire “DayManager” script (Obviously not all relevant, but I wanted to inclue it to be sure I didn’t omit something important):

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;

public class DayManager : MonoBehaviour {

    public static DayManager instance;

    [Header("Day Variables")]
    public int totalDays;
    //[HideInInspector]
    public int currentDay = 1;

    void Awake () {

        instance = this;

    }

    void Start () {
       
        TickManager.instance.SetTickPause(false);

    }

    public void EndDay () {

        TickManager.instance.SetTickPause(true);

        if (currentDay < totalDays) {
           
            SceneManager.LoadScene("Night View");
            //BeginNewDay();

        } else {

            //Final day stuff
            Debug.Log("Game end.");

        }

    }

    public void BeginNewDay() {
       
        currentDay++;
        SceneManager.LoadScene("Office");

    }

}

Issues been solved. Needed to say if (instance != null) in awake before setting instance = this;