Illegal view ID: 0 Error

Hi, I've recently started working with the PUN package in Unity. I am sort of new to developing, and I have been having trouble getting networking to work (most problems I've resolved through google, of course).

There is this one issue that I have not been able to find an answer to, however. I keep getting this error: "Illegal view ID:0 method: SwordRPC GO:game_controller".
Basically, my setup is a button that calls the SwordRPC method of a script component in the game_controller object. Game_controller is instantiated through PhotonNetwork.Instantiate and has a Photon View.

Whenever I debug it by checking the photon view ID every frame (on Update), it gives me a completely valid ID. But when I debug it by checking the ID in the method, it gives me 0. Strange!

Comments

  • I could use a repro case. If you can, send me a minimal project to: [email protected] and refer to this thread in the mail.
    Also let me know which version of Unity you use (the exact version number) and on which platform this happens.

    Getting 2 different values is weird.
    It might be a initialization problem but I thought I covered all cases.
  • edited August 2015
    Hello, I was wondering if this issue was solved because I am having the same problem. In the inspector, it shows that the object has a View ID of 5, but when I debug it, it states that the view ID is 0.

    Any idea what the problem could be?

    Edit: The only fix I've found for it so far was to find the object again at the RPC call and then get its photon view.

    Ex. GameObject.FindObject(object).GetPhotonView().RPC(etc...
  • @crodriguez08: I'm not sure I ever got a repro case, so I assume the issue could still be there. I never ran into it, though.

    When you debug it, it's 0. You mean debugging in MonoDevelop, not logging the value at runtime or something?

    Can you provide a debug case?
  • @Tobias Well, it started happening suddenly after adding another object to instantiate, where upon loading the next scene, I would network-instantiate several objects, and the last one to instantiate would appear to have an illegal view ID despite the inspector claiming it has a valid (aka greater than 0) view ID.

    In Debug.Log(photonView.viewID) it'd say it's 0, so when I would do a photonView.RPC call, that's where I'd get the error. Then I found the fix and implemented it.

    If you need me to send my project to see if it happens to you, let me know.
  • If I can reproduce the issue with your project, please send a download link to [email protected]
    If that's a lot of extra work, I'm also happy if you don't, as long as you can continue to work...
  • Hello i have the same problem why not work photonViewID?
  • Did you find a solution?
    Which Unity version are you using and which PUN version?
    This thread is rather old. I suggest to take a look at the other threads with similar topics, too. We will update PUN for Unity 2018.3, to accommodate for the new prefabs workflow.
Sign In or Register to comment.