Есть строка кода:
PhotonNetwork.Instantiate("Test", new Vector3(0,0,0), Quaternion.identity, 0);
В папке resources есть этот префаб, кстати, до этого еще спавнится Player, таким же путём, но именно эта строка не работает. Как мне исправить данную ошибку?
Весь код:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Photon.Realtime;
using ExitGames.Client.Photon;
using UnityEngine.UI;
using System.Threading.Tasks;
public class map : Photon.PunBehaviour
{
public Text text;
public int radius = 15;
public Generator generator;
public GameObject player;
// Start is called before the first frame update
void Start()
{
Destroy(GameObject.Find("Player"));
PhotonNetwork.ConnectUsingSettings("1.0");
}
private void OnConnectedToMaster()
{
PhotonNetwork.JoinLobby();
}
public override void OnJoinedLobby()
{
PhotonNetwork.JoinRandomRoom();
}
public override void OnJoinedRoom()
{
if(PhotonNetwork.room.PlayerCount < 2)
{
text.text = "wait for players";
}
else
{
PhotonNetwork.Destroy(text.gameObject);
}
player = PhotonNetwork.Instantiate("Player", Vector3.zero, Quaternion.identity, 0);
player.gameObject.tag = "Player";
print(player.gameObject.tag);
PhotonNetwork.Instantiate("Test", new Vector3(0,0,0), Quaternion.identity, 0);
}
public void OnEvent(EventData photonEvent)
{
if (photonEvent.Code == 1)
{
}
}
void OnPhotonInstantiate(PhotonMessageInfo info)
{
print("d");
}
void OnPhotonRandomJoinFailed()
{
PhotonNetwork.CreateRoom("play");
}
}