RPG instantiate problem

So I made a character class creation but I have a problem about instatiating the player in a new scene.
The script is set like this:

if (isWarriorClass == true || isMageClass == true || isArcherClass == true)
        {
            SceneManager.LoadScene("scene_main");
            Instantiate(newPlayer.Model);
        }

But it loads the scene and it doesn’t instantiate the public GameObject.
This is wrote in a public function that is called when a “Create player” button is clicked.
Can someone tell me how can I instantiate a GameObject after a scene is loaded?

The function “Instantiate” takes three arguments:
The original prefab
Location to put it
Rotation of object

The script first has to know which object to use, which you can do by having a public GameObject variable.

public GameObject newPlayer

You have to drag and drop your player model onto the empty GameObject slot in the script.
Then you can instantiate your prefab.

Instantiate(newPlayer, new Vector3(x, y, z),  Quaternion.Euler(x, y, z));

The Vector3 is the x, y, and z position.
The Quaternion.Euler is the x, y, and z rotation.

I hope this helps!

The problem is that LoadScene doesn’t happen immediately. It may take a frame. When you run that code, it’s likely instantiating it before the new scene is loaded. So, the best way to do this would be to have a spawner object in the new scene that takes the data from the old scene, and spawns the player in it’s Start function.

Instantiate is not working, because the next scene is loaded just before. Move the Instantiate to a Start function in the next scene.