Search Unity

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

Bug Netcode for GameObjects Camera issue

Discussion in 'Netcode for GameObjects' started by pupiman32, Aug 22, 2023.

  1. pupiman32

    pupiman32

    Joined:
    Aug 18, 2023
    Posts:
    2
    Players: p1 p2

    The game is working well with just p1 but when p2 joins in p1 thinks it camera is p2's camera

    I constantly have problems with this
     
  2. CodeSmile

    CodeSmile

    Joined:
    Apr 10, 2014
    Posts:
    5,015
    You have one or more network player prefabs.

    Put a camera child object inside that prefab and deactivate it.
    Upon spawning the network player, determine whether this is a local player or not.
    If local player, set that camera object to active. Otherwise do nothing.

    Remove any camera object/component already in the scene.

    That way only the local player‘s camera is active.
     
  3. pupiman32

    pupiman32

    Joined:
    Aug 18, 2023
    Posts:
    2
    thank you