To pass a variable between scenes should I use scriptableobject or static ?

I have two scenes. In the first one the The Space Station scene I have a object name Player. The Player have a child a main camera.

I also have another scene name Main Menu when I’m running the game I want it to start with the Main Menu scene and the also the Main Menu scene main camera.
If the Player will be on enabled true I will see the Player camera and the scene The Space Station will be the first one when running the game. So I turned off the Player.

Now when running the game it start with the main menu scene and the main menu camera.

In the main menu I have a button and I did that when I click on the button it will activate the Player and will unload the main menu scene:

This script is attached to a button on the main menu scene:

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

public class LoadSceneOnClick : MonoBehaviour
{
    public static bool isPlayer = false;

    public void ActivatePlayer()
    {
        isPlayer = true;

        if (PlayerEnable.playerStat == true)
            SceneManager.UnloadSceneAsync(0);
    }
}

And this script is attached to an empty GameObject in the other scene The Space Station:

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

public class PlayerEnable : MonoBehaviour
{
    public GameObject player;
    public static bool playerStat = false;

    private void Update()
    {
        if (LoadSceneOnClick.isPlayer == true)
        {
            player.SetActive(true);
            playerStat = true;
        }
    }
}

This way I can interact and access the Player object in both scenes. And it’s working fine.
My question is if I did it right ? If the scripts are fine and if it’s logic to do it this way ? Or maybe I should do it somehow with scriptableobject class ?

Good day.

When changing scenes, all Objects are deleted, and then all objects from new scene are instantiated., So, even if you have “identical” objects in both scenes, they are not the same object, they are different copies.

You must watch this Unity Tutorial about Persistence. It shows how to pass information between scenes, and how to save/load data when closing/starting the game again.

Bye!