- Home /
[PUN] Getting warnings and having problems with instantiation and PhotonView
So I am suddenly having a problem with the instantiation of my objects. This started happening after I changed something and even when I revert my changes the warnings still happen so I'm not sure if it is just my scripting or something else. But there are two errors that always appear. This one Received OnSerialization for view ID XXXX. We have no such PhotonView! Ignored this if you're leaving a room. State: Joined
always appears when I load the next scene and instantiate my players. Then I use PhotonNetwork.InstantiateSceneObject()
for my enemies. Both player and enemies have a photonview before getting instatiated but I don't think they are getting assigned. The way that I load my scene is just using the regular PhotonNetwork.LoadLevel(level#)
Which brings me to my other error which occurs when I deal any damage to 'some' enemies which is this error Received RPC "RPC_NAME" for viewID X but this PhotonView does not exist! Was remote PV. Remote called. By: 1 Maybe GO was destroyed but RPC not cleaned up.
Tried a bunch of different things and looked up some other solutions which is why I use scene objects and loadlevel but it still does the same thing.
Here is where I instantiate my network prefab pick for players and enemy: https://pastebin.com/ZcQsaKVb This is the script where I instantiate my enemy scene object: https://pastebin.com/gE8Dajmd
Answer by NINADHAJARE · Mar 28 at 01:57 PM
Have you got any solution for it if you found it then please let me know because i have also got this same problem...
can you open up your question as new question instead and link to this? Then please try to be specific and post the relevant code parts. It could help if you could basically boil it down to a minimal setup that reproduces this issue.
Either way from trying to understand the OP then the issue is partly the following: All Photon messages try to reach a certain target photonView ID. If you change scene and reinstantiate your player characters then there will still be messages on the way from the old scene which now cannot find the old ID since you destroyed your old players. You should probably keep the characters with DontDestroyOnLoad
so that you can keep the old PhotonviewID.
Cannot really tell what the other issue is about. Some more details would be helpful here. Is there a Photonview on the Enemies? Are they only instantiated from the Master? <- please be really sure about this one.
Your answer
![](https://koobas.hobune.stream/wayback/20220612211625im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
How to add Turn Based to Photon Pun 1 Answer
How to make a moving enemy's eye to follow player? 1 Answer
HELP, Scripts dont work after instantiation. 0 Answers
Multiple Cars not working 1 Answer