I have a problem. I want to instantiate 2 objects but to instantiate it with the same object, and what I want is to instantiate the first object and after some way say that if the first object was instanced the second instancie instead of returning to instantiate the first.
I tried to do it this way:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class NetworkManager : Photon.MonoBehaviour {
public string Version;
[SerializeField]private bool Join;
void Start()
{
PhotonNetwork.ConnectUsingSettings(Version);
}
void OnConnectedToMaster()
{
PhotonNetwork.JoinOrCreateRoom("Lucha", new RoomOptions() {MaxPlayers = 2}, null);
}
void OnJoinedRoom()
{
if(Join == false)
{
PhotonNetwork.Instantiate("Jugador", transform.position, transform.rotation, 0);
Join = true;
}
if(Join == true)
{
PhotonNetwork.Instantiate("Jugador2", transform.position, transform.rotation, 0);
}
Debug.Log("Join");
}
}
But no ... I'm a player twice What I try to do is that if a person is already connected, that the next person who connects instead of instar player, instancie player2