Search Unity

Third Party Spawn GameObjects via network (Photon 2, photonview.IsMine problem)

Discussion in 'Multiplayer' started by Nikmady, Sep 19, 2019.

  1. Nikmady

    Nikmady

    Joined:
    Mar 31, 2019
    Posts:
    7
    Hello. Help me please, I have a problem with spawn FX-effects.
    Here Is the situation.
    I have 2 cubes (2 VR hands) which shouldn’t collide between themselves and FX-effect shouldn’t be created.

    When I’ll collide the Network player, FX should be create.
    I’ve made a script which do all what I need. FX works fine. When I collide the Network-player FX are created.
    But! Here is the problem:
    In my GamePlay(locally) when I’ve collide my cubes(my VR-hands) between themselves nothing happens, but the Network player tell me that FX-effects are created. And same situation with him. He doesn’t see FX-effect when he is collide his cubes(VR-hands), but I have see it.
    Help please, what function/variable I’ve missed?

    Here is the Code.
    Code (CSharp):
    1. private void OnCollisionEnter(Collision collision)
    2.     {
    3.  
    4.         if (((collision.gameObject.name == "CubeRed") || (collision.gameObject.name == "CubeGreen"))
    5.             && (!photonView.IsMine))
    6.         {
    7.            
    8.             foreach (ContactPoint contact in collision.contacts)
    9.             {
    10.                 GameObject FxInst = Instantiate(FXprefab, contact.point, Quaternion.identity);
    11.                 //PhotonNetwork.Instantiate(FXprefab.name, contact.point, Quaternion.identity);
    12.  
    13.             }
    14.         }
    15.     }
    Sorry for links: (forum doesnt attach the pictures)
    Pictures: https://ibb.co/Px2RSPg
    https://ibb.co/FXcSb4H
    https://ibb.co/RDdrhph
     

    Attached Files: