Only first joined (master) owns player, How for other joiners?
I am trying in my first Photon Unity Networking project and there is one gameobject in my scene. I can connecting two player in One room. The master (who joined first) can move that object but other can not.
I want create new gameobject for every player just when he/she joined The room and every player be able to control own object. Of cource every moving must be visible for all.
PLEASE help me for my DREAM !
public override void OnJoinedRoom() {
...
PhotonNetwork.Instantiate(player.name, new Vector3(0, 3.0f, 0), Quaternion.identity);
}
Player is a prefab that have Photonview, PhotonTransformView and Rigidbody componnents.
Answers
-
if(GetComponent<PhotonView>().IsMine) //Everything inside these brackets will only happen for the specific player that is using it
{
//Do stuff
}
0 -
Feel free to email me at kleemoffdeveloper@gmail.com. I know how frustrating it can be to try and figure this stuff out alone
0 -
Thanks, but removing if line, doesn't solve problem.
0