Unity 2d select 2 object on another 2 scenes

Hi, my name is Taha.

I wanna select 2 object in a script but this 2 object is on another 2 scenes.

I add a DontDestroyOnLoad();

If scene is 0 happend anything,
If scene is 1 happend anything.

How can i do that or can i do that?

my code:

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

public class game : MonoBehaviour
{
    public GameObject object1;//object on first scene
    public GameObject object2;//object on second scene

    public float scene;

    private Rigidbody2D rb1, rb2;
    void start()
    {
        rb1 = object1.GetComponent<Rigidbody2D>();
        rb2 = object2.GetComponent<Rigidbody2D>();

        DontDestroyOnLoad(gameObject);
    }
    void update()//this is a example
    {
        if (scene == 0)
        {
            //bla
        }
        if (scene == 1)
        {
            //bla
        }
    }
}

Kanka türkçe olarak tekrar açıkla bakayım bi

Scriptable Object kullanabilirsin. Onlar sahnelerin dışında olduğu için istediğin zaman değiştirirsin.