Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Join us on Dec 8, 2022, between 7 am & 7 pm EST, in the DOTS Dev Blitz Day 2022 - Q&A forum, Discord, and Unity3D Subreddit to learn more about DOTS directly from the Unity Developers.
    Dismiss Notice
  3. Have a look at our Games Focus blog post series which will show what Unity is doing for all game developers – now, next year, and in the future.
    Dismiss Notice

Question Photon Multiplayer setting multiple gameobjects

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

  1. Hallowed_


    Sep 27, 2020
    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


    Apr 7, 2009