Search Unity

  1. Are you interested in providing feedback directly to Unity teams? Sign up to become a member of Unity Pulse, our new product feedback and research community.
    Dismiss Notice

Help Wanted Photon Multiplayer setting multiple gameobjects

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

  1. Hallowed_

    Hallowed_

    Joined:
    Sep 27, 2020
    Posts:
    2
    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:
    2,674
unityunity