Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

How to spawn local player always at center of screen and enemy players at left/right of local player

Discussion in 'Multiplayer' started by iloveneh, Apr 6, 2017.

  1. iloveneh

    iloveneh

    Joined:
    Apr 6, 2017
    Posts:
    1
    Hi, I am new to Unity and I am trying to build a multiplayer tower-based game. In essence, what I am trying to achieve is to have the local player always at the center of the screen, zoomed-in, and any other enemy players spawning to their left or right.

    I have searched around and most of the tutorials seemed to be about creating a few spawn locations, and then using the Network Start Position to randomly assign each player to one of these spawn locations.

    I have read from Unity's tutorial that we can use the OnStartLocalPlayer method to set certain attributes to the local player (eg. in the tutorial, it was setting the colour of the local player to Blue), but I am not sure how to extend that to the player's spawning location and camera position.