Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

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,569
    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.