Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice

Question (FishNet) Mesh Renderer automatically disabled for other clients on join

Discussion in 'Multiplayer' started by Nathan_I, Jan 22, 2024.

  1. Nathan_I

    Nathan_I

    Joined:
    Jan 10, 2020
    Posts:
    3
    I just started with Fishnet this morning.
    Im using the built in network manager to start a server / client, then in build im connecting with a client. i have a simple player prefab with a capsule mesh and a network transform, as well as a simple networkbehaviour that parents the main camera to the local player transform.

    im having a strange issue where both players can connect just fine, but the mesh renderer for the other player is automatically getting disabled. in scene view i can see that movement changes are getting synced. Im not sure why the mesh renderer is getting disabled or how to fix that.

    I highlighted player 1 and player 2 in the screenshot. For debug purposes the camera is positioned in third person perspective behind the local player.
    upload_2024-1-22_11-6-2.png
     
  2. maxkratt

    maxkratt

    Joined:
    May 8, 2020
    Posts:
    4
    Hi there, if you launch the build as the server+client and the Unity editor as the solo client, can you still see two player objects in the editor hierarchy?
     
  3. Punfish

    Punfish

    Joined:
    Dec 7, 2014
    Posts:
    411
    MeshRenderers are disabled by default if the clientHost is not observing the object.
    This is so the object still runs on the server, but also so the clientHost does not see objects they are not supposed to.

    There is likely an observer condition blocking the players from seeing each other. You can use the included PlayerSpawner script to spawn players, with add to default scene marked.
    Or you can remove the ObserverManager from your network manager.

    Strongly recommend reviewing observer conditions though as they're very powerful and useful.
    https://fish-networking.gitbook.io/docs/manual/components/managers/observermanager