Illegal view ID

The whole answer can be found below.

Please note: The Photon forum is closed permanently. After many dedicated years of service we have made the decision to retire our forum and switch to read-only: we've saved the best to last! And we offer you support through these channels:

Try Our
Documentation

Please check if you can find an answer in our extensive documentation on Realtime.

Join Us
on Discord

Meet and talk to our staff and the entire Photon-Community via Discord.

Read More on
Stack Overflow

Find more information on Stack Overflow (for Circle members only).

Write Us
an E-Mail

Feel free to send your question directly to our developers.

Illegal view ID:0 method: LoadPlayer GO:Networking Manager

Shadowing
2017-04-28 13:18:03

Idk i can't seem to wipe this error out. Plus I get it twice when the scene loads for some reason. Everything works fine except I get this error in my log.

It only does it on this GameObject. I Instatiate other photonViews with no errors.
Its a prefab that gets Instantiated but not photonNetwork.Instatiated.

So thats the only difference. My other photonViews that don't give errors are characters in the game that are all PhotonNetwork.Instatiated.

Illegal view ID:0 method: LoadPlayer GO:Networking Manager
UnityEngine.Debug:LogError(Object)
NetworkingPeer:RPC(PhotonView, String, PhotonTargets, PhotonPlayer, Boolean, Object[]) (at Assets/Scripts/Third Party Assets/Photon Unity Networking/Plugins/PhotonNetwork/NetworkingPeer.cs:3561)
PhotonNetwork:RPC(PhotonView, String, PhotonTargets, Boolean, Object[]) (at Assets/Scripts/Third Party Assets/Photon Unity Networking/Plugins/PhotonNetwork/PhotonNetwork.cs:2892)
PhotonView:RPC(String, PhotonTargets, Object[]) (at Assets/Scripts/Third Party Assets/Photon Unity Networking/Plugins/PhotonNetwork/PhotonView.cs:597)
c__Iterator0:MoveNext() (at Assets/Scripts/Random/SpawnPlayer.cs:139)
UnityEngine.SetupCoroutine:InvokeMoveNext(IEnumerator, IntPtr)

Comments

Tobias
2017-05-31 08:39:02

Its a prefab that gets Instantiated but not photonNetwork.Instatiated.

Means you have a PhotonView on this GO but don't use our Instantiate() method?
That's the explanation.
Our Instantiate() variant makes sure the PhotonView is setup correctly, even before Awake() gets called on the new GO instance.

You need to assign a viewID manually (in best case, the same on all clients in a room) or will get this error.

Shadowing
2017-05-31 14:54:48

Thanks man.
Ahh ok i bet you are right then. Thats probably it. I think i am Instantiating a prefab that has photonView attached to it with out photon Instantiate. Infact I believe its exactly two prefabs which is why im getting two errors.

Shadowing
2017-06-02 07:05:55

sweet Thanks Tobias.
That fixed my issue.
I would of never of guessed that was the issue lol.

Tobias
2017-06-12 14:03:36

Hehe. Means I have to work on the error messages ;)
Glad we could solve this!

mariappan
2021-04-27 15:18:02

Hi @Shadowing and @Tobias can you please explain how did you assign photon view Id manually. I am also facing the same issue.

Tobias
2021-04-30 08:51:44

Compared to 2017 (which is when the last post was made in this thread), we've got way more info in the documentation. Have a look at "Manual Instantiation".

ViewIDs are not used in the DotNet SDK, by the way. This would be a topic for the PUN subforum.

Seth01Master
2022-11-13 23:08:12

I am getting the same problem with my code, but I am using PhotonNetwork.Instantiate(). Any help?

Tobias
2022-11-14 08:54:37

Please create a new Thread with the full callstack for your problem.

And please use the PUN category of this forum.

stubing
2023-01-04 02:20:07

I ran into this same issue and here is how I fixed it without using photon to instantiate the GameObject

before:

photonView.RPC("SaveData", RpcTarget.All);


After:

PhotonView photonView = PhotonView.Get(this);

if (photonView.IsMine)

photonView.RPC("SaveData", RpcTarget.All);

Back to top