- Home /
PhotonNetwork.Instantiate is not "buffered"
Hello, I'm currently creating simple multiplayer first person shooter using PhotonNetwork engine, but I got crushed into the problem.
The problem I have is this:
I spawn Player1 using Manager by (PhotonNetwork.Instantiate)
I spawn Player2 using Manager by (PhotonNetwork.Instantiate)
but the problem is player1 can see player2, but player2 cannot see player1. I figured it out that it's not "buffered" Is there a way to solve this problem?
Hi,
PhotonNetwork.Instatiate(...) is buffered, so there shouldn't be a problem with that. Do you use the group parameter of the function (the last one) with any value else than 0 in one of these cases? In this case you need to set sending and receiving enabled for all clients.
$$anonymous$$y group parameter is "0" Here is my piece of code where I instantiate the object:
player = (GameObject)PhotonNetwork.Instantiate("myPlayer", Vector3.zero, Quaternion.identity, 0);
I thought I did solved the problem, but I didn't. I'm still having this problem. Please someone help me. The thing is whenever I try the photonnetwork.Instantiate in my "test project", and it worked. I think there is something with my script...
player = (GameObject)PhotonNetwork.Instantiate("myPlayerClassInit", new Vector3(0, 10, 0), Quaternion.identity, 0);
player.GetComponent<LobbyPlayerSetup>().enabled = true;
This is litterly what I have in void Start() method... Please help me
You can try moving the Instantiation call from the Start() function to a OnJoinedRoom() callback. This makes sure that the client has definitely joined the room.
Can you tell us what happens in LobbyPlayerSetup script / component? I am also a bit confused about this name, because there are differences about the lobby and the room.
Ok, in LobbyPlayerSetup, it's where I change the name of an object that I instantiated. I used simple GetComponent().RPC("ChangeName", PhotonTargets.AllBuffered, username); and there is no problem with it.
I'll explain you the scene. So basically, I''m trying to make a class selection scene. When ever the player gets into the room, I instantiate an object to the class selection scene, and in that object, there are some variables such as "current Class" or which $$anonymous$$m i'm belonging. And I made sure that instantiation call is called AFTER when player joined room. I checked using simple "ConnectionStateDetailed", and I even gave a little bit of delay using StartCorutine, and tried "OnJoinedRoom".