Hi,
I created a waiting room where the players are divided into two different teams, now I would like the two teams to appear in two different points of my map, but I probably did something wrong because in this way the spawn group is changed but the players of team 1 are not in the same scene as team 2.
I created a waiting room where the players are divided into two different teams, now I would like the two teams to appear in two different points of my map, but I probably did something wrong because in this way the spawn group is changed but the players of team 1 are not in the same scene as team 2.
C#:
namespace Opsive.UltimateCharacterController.AddOns.Multiplayer.PhotonPun.Game
{
using Photon.Realtime;
using Photon.Pun;
using UnityEngine;
using Opsive.Shared.Events;
using Hashtable = ExitGames.Client.Photon.Hashtable;
using Opsive.UltimateCharacterController.Game;
public class CharacterSpawnManager : SpawnManagerBase
{
[SerializeField] protected GameObject[] m_Characters;
public int SpawnGroupingTeam
{
get { return SpawnPointGrouping; }
set { SpawnPointGrouping = value; }
}
void OnEnable()
{
Team t = PhotonNetwork.LocalPlayer.GetPlayerTeam();
if (t == Team.Team1)
{
Debug.Log("team 1");
SpawnPointGrouping = 1;
Debug.Log("group: " + SpawnPointGrouping);
}
else if (t == Team.Team2)
{
Debug.Log("team 2");
SpawnPointGrouping = 0;
Debug.Log("group: " + SpawnPointGrouping);
}
}
protected override GameObject GetCharacterPrefab(Player newPlayer)
{
if (newPlayer.CustomProperties.ContainsKey("ID"))
{
int result = (int)newPlayer.CustomProperties["ID"];
Debug.Log("Character ID : " + result);
return m_Characters[result];
}
else
{
return m_Characters[0];
}
}
}
}