Search Unity

Help with photon 2

Discussion in 'External Tools' started by Thoms0n45, Aug 27, 2019.

  1. Thoms0n45


    Apr 27, 2018
    Hello my name is Matias, I am new to the unity forum so if there is something wrong with this post I ask you to let me know. I am currently making a basic game consisting of two paddles (players) and a ball. When either player clicks on the screen, the ball begins to move and if it passes behind the platform, it is a point for the opponent. The problem is that the opponent cannot see the movement of the ball.

    The ball has Photon View and is being instantiated right after instantiating the first player, as follows:

    if(PhotonNetwork.CurrentRoom.PlayerCount == 1){
    // Instantiate Player
    PhotonNetwork.Instantiate(, new Vector3(-7.46f,0f,0f),Quaternion.identity);
    // Instantiate Ball
    PhotonNetwork.Instantiate(, new Vector3(0f,0f,0f),Quaternion.identity);

    In another script he indicated that when a player touches the screen the ball acquires movement and this is the one that the other player does not see.

    void Update()
    if(!gameStarted && PhotonNetwork.CurrentRoom.PlayerCount == 2){
    transform.position = new Vector3(0f,0f,0f);
    if (Input.GetMouseButtonDown(0))//Click izquierdo 0, derecho 1
    gameStarted = true;
    ballRigidBody2D.velocity = new Vector2(8,8);