Change player prefabs when entering a new scene

Support for MFPS 2.0
Post Reply
User avatar
Devin+
New Member
New Member
Posts: 2
Joined: Mon Nov 09, 2020 2:50 pm

I have a multiplayer game for 2 people.

I have 4 character prefabs:
Character prefab 1
Character prefab 2
Character prefab 3
Character prefab 4
I have 2 scenes:
Scene 1
Scene 2

Player 1 and player 2 spawn into Scene 1 as character prefab 1 and character prefab 2 ( because I have set those prefabs as player 1 and player 2 in the game data inspector.

Now when I change scene to scene 2 I want player 1 to spawn as character prefab 3 and player 2 to spawn as character prefab 4.

Maybe a long shot but if anyone can gimme a point in the right direction i'd be eternally grateful. Thanks:)
User avatar
Devin+
New Member
New Member
Posts: 2
Joined: Mon Nov 09, 2020 2:50 pm

I changed the code in this part of the gamemanager script.
I now spawn as the correct prefab but cant see the other player.
What am I doing wrong *cry*



public void SpawnPlayerModel(Team t_team)
{
Vector3 pos;
Quaternion rot;
if (t_team == Team.Team2 && SceneManager.GetActiveScene () == SceneManager.GetSceneByName ("scene1"))
{
GetSpawn(ReconSpawnPoint.ToArray(),out pos,out rot);
LocalPlayer = PhotonNetwork.Instantiate(bl_GameData.Instance.Player1.name, pos, rot, 0);
}
else if (t_team == Team.Team1 && SceneManager.GetActiveScene () == SceneManager.GetSceneByName ("scene2"))
{
GetSpawn(DeltaSpawnPoint.ToArray(), out pos, out rot);
LocalPlayer = PhotonNetwork.Instantiate(bl_GameData.Instance.Player2.name, pos, rot, 0);
}
if (t_team == Team.Team2 && SceneManager.GetActiveScene () == SceneManager.GetSceneByName ("scene1"))
{
GetSpawn(ReconSpawnPoint.ToArray(),out pos,out rot);
LocalPlayer = PhotonNetwork.Instantiate(bl_GameData.Instance.Player3.name, pos, rot, 0);
}
else if (t_team == Team.Team1 && SceneManager.GetActiveScene () == SceneManager.GetSceneByName ("scene2"))
{
GetSpawn(DeltaSpawnPoint.ToArray(), out pos, out rot);
LocalPlayer = PhotonNetwork.Instantiate(bl_GameData.Instance.Player4.name, pos, rot, 0);
}
LocalActor.Actor = LocalPlayer.transform;
LocalActor.ActorView = LocalPlayer.GetComponent<PhotonView>();
if(!EnterInGamePlay && bl_MatchInformationDisplay.Instance != null) { bl_MatchInformationDisplay.Instance.DisplayInfo(); }
EnterInGamePlay = true;
bl_EventHandler.PlayerLocalSpawnEvent();
bl_UCrosshair.Instance.Show(true);
}
User avatar
Lovatto
Admin
Admin
Posts: 1555
Joined: Sun Dec 07, 2014 3:18 pm
Contact:

Send me your MFPS purchase invoice number in a PM and I'll assist you with this.
Post Reply