I cant use MoveGameObjectToScene

Im making a skin simulator game and ı want to move my skins to Inventory scene. Im trying to use MoveGameObjectToScene but it doesnt working it says “Destination Scene Is Not Valid”[163108-adsız.png|163108]

You need to load your “Inventory” scene in the background before calling MoveGameObjectToScene(), to do this make a coroutine that waits until the scene is loaded in the background before calling MoveGameObjectToScene().

e.g;

public void confirm() { 
    DontDestroyOnLoad(win);
    win.SetActive(false);
    StartCoroutine(Example()); 
}

 private IEnumerator Example() {
     Scene loadScene = SceneManager.GetSceneByName("Inventory");
 
     AsyncOperation asyncLoad = SceneManager.LoadSceneAsync(loadScene, LoadSceneMode.Additive);
 
     while (!asyncLoad.isDone) {
         yield return null;
     }
 
     SceneManager.MoveGameObjectToScene(win, loadScene);
 }

Also if you’re going to be doing this many times before actually advancing to the Inventory scene then you may want to only load that scene in once instead of every time you call confirm().

And double check that the Inventory scene is included in the build order or none of it will work by going to File > Build Settings > Add Open Scenes when you have the Inventory scene loaded.