Keeping an object in a multiplayer scene, when a player joins.
I'm having some trouble with instantiating objects on the network. Currently using UFPS and Photon Networking to develop a indie zombie fps. My issue is when I (the master client) am in a server the zombie will be instantiated using PhotonNetwork.Instantiate, but when a non master client joins i cannot see the zombie which was previously instantiated, before the (non-master client) joined. How would I go about doing this so that the zombie(gameObject), will still be in the server even when the non-master client is not. At the moment, it works but it doesn't save the zombies globally so that the object is there before i load the game as a non master client, it loads everything that is instantiated after join.
if (PhotonNetwork.isMasterClient) { Debug.Log("Spawning on the network"); PhotonNetwork.Instantiate(spawnObj.name, transform.position, transform.rotation, 0); }
Answer by godofwarfare115 · Feb 11, 2016 at 08:57 PM
I am having the same issue, I am also receiving a warning when objects are instantiated Received OnSerialization for view ID 1002 We have no such PhotonView! Ignored this if you're leaving a room. State: Joined
Answer by General-Troll · Jul 25, 2016 at 07:35 PM
Just to clear this up for anyone else who comes to this question looking for an answer, you MUST have a Photon View script attached to it, and make sure the Photon View is observing the Transform, if you don't have anything else for it to observe. I also recommend watching quill18's tutorial on making a Multi-Player FPS, which should give you most of your answers.
Your answer
Follow this Question
Related Questions
How to choose different teams one by one 1 Answer
C# Photon Networking - Preventing duplicate GameObjects from spawning on Join. 1 Answer
Check what group id you have after being instantiated. (PUN) 1 Answer
Instantiating as a child of an object in hierarchy 1 Answer
Referencing a GameObject's Components from if Statements (c#) 0 Answers