View ID error

Options
1: I keep getting this error with photon and unity3d. I think its because the script I am running is being set to view 0 and 0 isn't allowed from what Ive read. I believe its because the bullet is a quick spawning raycast and it doesn't have time to set a view number for the photon view so it just becomes 0, how would i fix this? I didn't get the error on my old project with the same code and same setup. I also see someone posted in December about the same problem (maybe its a current bug with PUN?) Here is the error.

Illegal view ID:0 method: SpawnBlood GO:PistolBullet(Clone) UnityEngine.Debug:LogError(Object) NetworkingPeer:RPC(PhotonView, String, PhotonTargets, Object[]) (at Assets/Photon Unity Networking/Plugins/PhotonNetwork/NetworkingPeer.cs:2614) PhotonNetwork:RPC(PhotonView, String, PhotonTargets, Object[]) (at Assets/Photon Unity Networking/Plugins/PhotonNetwork/PhotonNetwork.cs:1907) PhotonView:RPC(String, PhotonTargets, Object[]) (at Assets/Photon Unity Networking/Plugins/PhotonNetwork/PhotonView.cs:254) cj_HitscanBullet:DoHit() (at Assets/_CJ's Assets/Scripts/CJUFPS/Base/Scripts/Gameplay/cj_HitscanBullet.cs:53) cj_HitscanBullet:Start() (at Assets/_CJ's Assets/Scripts/CJUFPS/Base/Scripts/Gameplay/cj_HitscanBullet.cs:10)

Had to lookup view that wasn't in dict: View (0)0 on PistolBullet(Clone) (scene) UnityEngine.Debug:LogWarning(Object) NetworkingPeer:GetPhotonView(Int32) (at Assets/Photon Unity Networking/Plugins/PhotonNetwork/NetworkingPeer.cs:2393) NetworkingPeer:ExecuteRPC(Hashtable, PhotonPlayer) (at Assets/Photon Unity Networking/Plugins/PhotonNetwork/NetworkingPeer.cs:1672) NetworkingPeer:RPC(PhotonView, String, PhotonTargets, Object[]) (at Assets/Photon Unity Networking/Plugins/PhotonNetwork/NetworkingPeer.cs:2653) PhotonNetwork:RPC(PhotonView, String, PhotonTargets, Object[]) (at Assets/Photon Unity Networking/Plugins/PhotonNetwork/PhotonNetwork.cs:1907) PhotonView:RPC(String, PhotonTargets, Object[]) (at Assets/Photon Unity Networking/Plugins/PhotonNetwork/PhotonView.cs:254) cj_HitscanBullet:DoHit() (at Assets/_CJ's Assets/Scripts/CJUFPS/Base/Scripts/Gameplay/cj_HitscanBullet.cs:53) cj_HitscanBullet:Start() (at Assets/_CJ's Assets/Scripts/CJUFPS/Base/Scripts/Gameplay/cj_HitscanBullet.cs:10)

2: Which unity pun demo has ALL the photon commands in it? I still don't know how to do a lot of PUN stuff. I don't even know how to set the view id through script. What would be the best PUN unity demo scripts to look at?

Comments

  • Tobias
    Options
    1: You should not network-spawn a GameObject for bullets. Simply do a RPC "i shot from here to there" and send those positions. Any client can create a visual representation for that bullet easily but you won't have to remove the object from the network just to get rid of it.

    2: A PhotonView viewID is only set once and never changed. It's an identifier and as such should not change. What do you try to do?

    There are several demos in the PUN package and all of the methods in the PhotonNetwork class are documented and described and there is a doc PDF in the package, too. I fear, that's all there is for the time being.