Spawn GameObjects via net (Photon 2, photonview.IsMine problem)

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 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, but I have see it.
Help please, what function/variable I’ve missed?

Here is the Code.
private void OnCollisionEnter(Collision collision)
    {

        if (((collision.gameObject.name == "CubeRed") || (collision.gameObject.name == "CubeGreen")) 
            && (!photonView.IsMine))
        {
            
            foreach (ContactPoint contact in collision.contacts)
            {
                GameObject FxInst = Instantiate(FXprefab, contact.point, Quaternion.identity);
                //PhotonNetwork.Instantiate(FXprefab.name, contact.point, Quaternion.identity);

            }
        }
    }
And the Second question, how I can count the numbers of players which are already connected to the room? Not Lobby. Needs exactly the numbers of room’s players.
Thanks.

Comments