I'm making a multiplayer system. I have a strange situation about Start()
. When the first player joins there is 2 logs "player joined". So, when second player joins, their model instantiates twice (there is PhotonNetwork.Instantiate
in Start()
). I guess Start()
is being called 2 times somehow?
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Photon.Pun;
using TMPro;
public class MPRoomServer : MonoBehaviour
{
public GameObject rocket;
public TMP_Text title;
// Start is called before the first frame update
void Start()
{
PhotonNetwork.Instantiate(rocket.name, new Vector3(20.4928417f,4.3900001f,-10.116004f), Quaternion.identity);
title.text = "Room " + PhotonNetwork.CurrentRoom.Name;
Debug.Log("New player joined");
}
// Update is called once per frame
void Update()
{
}
}