- Home /
DontDestroyOnLoad and Photon, players not visible
Hello guys,
I have come across a problem and it has been bothering me for the past day or two. In my game I set up the player's spell to be ready for the fight scene, so after its done I use DontDestroyOnLoad to keep it to the next scene where the other players are gonna be connecting. After its loaded and the match starts I enable these objects in the fight scene but the players can not see each other. I understand that this is because it is not PhotonNetwork.Instantiate but if I want to instantiate with Photon to make it visible for other players (I had it like that and players could see each other) I have to use a prefab inside the Resources folder, but that prefab doesnt have the spells that the players selected in the previous scene. So I'm looking maybe if there is a way to use Photon Instantiate and create a object from a object in script (the player object that is passed is saved in a gameController that is passed as well ) I would really appreciate any help here, thanks!
Answer by ChristianSimon · Sep 07, 2017 at 08:31 AM
Hi,
I guess you are looking for something similar to Manual Instantiation. If you have instantiated the characters using PhotonNetwork.Instantiate you can either use a RPC call or the RaiseEvent function to instantiate the spell on all clients. The guide uses a RPC call for this example which might be a good entry point for you.
So you basically store the selected spell somewhere, join the room, instantiate the networked character object by using PhotonNetwork.Instantiate and then use a RPC to instantiate the spell as well.
Your answer
Follow this Question
Related Questions
PlayerPrefs and photon? 0 Answers
UNet, how to create Internet game (like via PhotonNetwork) 0 Answers
Photon wont sync for the masterclient. 1 Answer
Photon Networking - Synchronization problem 1 Answer
Photon mirroring animation? 3 Answers