Warning "Had to lookup view that wasn't in photonViewList"

Options
Hi,
I'm having this warning showing up "Had to lookup view that wasn't in photonViewList: View (0)1002 on ReadyZone (3)". To quickly explain the who and why, it's happening in a script when I call a photonView.RPC for PhotonTargets.All. I manually generated the viewID for this object with PhotonNetwork.AllocateViewID (), and successfully transfered it to every clients (no idea if it's linked, but I don't have that kind of warning with my player, instantiated with PhotonNetwork).

So the warning is showing up as soon as I call the RPC. I've looked up the code that generates the warning and it comes from the GetPhotonView function in NetworkingPeer.

if (view.didAwake)
{
Debug.LogWarning("Had to lookup view that wasn't in photonViewList: " + view);
}

I don't understand why a view should generate an warning if it went through it's awake .. but if it's here I guess there must be an explanation. Does anyone know what am I doing wrong ?

Comments

  • jeanfabre
    Options
    Hi,

    Indeed, it looks like your viewId management is faulty.

    -Can you explain why in the first place you want to manually control viewIds? this is opening a can of worm and it's strongly suggested not to do that unless you have extensive experience on PUN

    - look up in the inexpector for that ReadyZone GameObject and PhotonView and check the viewID, is it the one you expect?


    Bye,

    Jean
  • XRay
    XRay
    edited November 2016
    Options
    I do it manually because it's a scene object, I want it to be present when I build the scene. I don't want to spawn it by code like my player.
    And yes, the viewID seems to be correct. The RPC actually works but it always generates that warning. My player's viewID (spawned with PhotonNetWork) is 1005 and the ReadyZones are 1001 to 1004.
  • jeanfabre
    Options
    Hi,

    A Scene Object doesn't need a manual View Id, and it can be there in the scene during editing, have you tried that? I am not sure you need to deal with manual view Id in your case.

    Bye,

    Jean
  • XRay
    Options
    I don't get it. How do I do it ? The only way I know is to do a PhotonNetwork.Instantiate() but It's only done at runtime. That's why I'm setting the viewID with PhotonNetwork.AllocateViewID () during the Awake().
  • jeanfabre
    Options
    Hi,

    I see, you need to use PhotonNetwork.InstantiateSceneObject() that will help :)

    http://doc-api.exitgames.com/en/pun/current/class_photon_network.html#a890353cbe3141ca134a1b0e28aa8ea9f

    Bye,

    Jean
  • XRay
    Options
    Ho ok ... so yeah I didn't really understood the difference between scene object and "client's" object. I dug up a little bit and found the problem.

    Basically, I put the prefab of a ReadyZone (with the component PhotonView already attached to it) in the scene and in the Awake, of my own script, I check if the cllent was master then it generated a new viewID that it would send afterward to everyone, the probleme was here, Currenlty, from what I saw, if you change a viewID more than once, it won't be updated in the photonViewList (that part seems to be under TODO status) and this is precisely what was happening. At first the object updated it's own viewID with as owner the scene and then I came up with the new viewID allocation and this time it didn't updated in the list resulting with that warning.

    Thanks for the help.
  • jeanfabre
    Options
    Hi,

    I think in your case you don't need custom view ID to begin with. you can put a Prefab in the Scene Hierarchy at editing time, with a photonView in it, and Photon will know it's a Scene Object. At runtime it will be networked fine and will be controlled by the MasterClient as a SceneObject. In this case Photon assigned a ViewId automatically, there is no manual allocation to do.

    Check the DemoChangeOwner-Scene demo in PUN package, you'll have a prefab OwnershipSphere already in the scene and the photonView under the Owner property mentions "scene", so it's all good and nothing needs to be done.

    Bye,

    Jean