Search Unity

Third Party Photon Multiplayer setting multiple gameobjects

Discussion in 'Multiplayer' started by Hallowed_, Jun 19, 2021.

  1. Hallowed_

    Hallowed_

    Joined:
    Sep 27, 2020
    Posts:
    7
    Ok, so I'm not exactly sure how to phrase it, but I'm making a multiplayer game (using photon) and I have what is effectively a GameManager which moves the player, however it uses a code which goes:


    -------------------------------------------------------------------------------------------------------------------

    GameObject player;

    void Start()
    {
    player = GameObject.FindGameObjectWithTag("Player");
    }

    //irrelevant code

    player.transform.position = new Vector3(player.transform.position.x, player.transform.position.y, player.transform.position.z - 0.02f);

    -------------------------------------------------------------------------------------------------------------------


    Now, this code works fine, moves the player and whatever - but when there is 2 players it only moves 1 of them because its only defining GameObject player; and not a second or third player. How would I make it move the other players?
     
  2. tobiass

    tobiass

    Joined:
    Apr 7, 2009
    Posts:
    3,066