Search Unity

  1. We are migrating the Unity Forums to Unity Discussions. On July 12, the Unity Forums will become read-only. On July 15, Unity Discussions will become read-only until July 18, when the new design and the migrated forum contents will go live. Read our full announcement for more information and let us know if you have any questions.

Question cinemachine with nertworking

Discussion in 'Cinemachine' started by BrunoPOG, Mar 6, 2023.

  1. BrunoPOG

    BrunoPOG

    Joined:
    Jun 14, 2022
    Posts:
    2
    im working with netcode to make a multiplayer game and with cinemachine too.
    I have a question that i dont find an answer.

    How i do a reference of cinemachine with the spawned player?

    Im use the networking manager to spawn a player but when he spawn, the cinemachine lost the reference and dont follow the player. so, how i can attach the player in cinemachine when the scene starting as a host?
     
  2. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,905
    When you spawn the player, you nedd to set the vcam's target to be the newly-spawned player, eg:
    Code (CSharp):
    1. vcam.Follow = vcam.LookAt = newlySpawnedPlayer
     
    BrunoPOG likes this.