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

Unity 2017.1 Unet NetId missmatch issue

Discussion in 'UNet' started by xVergilx, Jun 23, 2017.

  1. xVergilx

    xVergilx

    Joined:
    Dec 22, 2014
    Posts:
    3,296
    I'm having this issue for a few days now. Working on a client and a server in a separate projects. It seems like two identical scenes somehow generate two different sets of NetId's for scene objects.
    I've checked the scene, and all NetId objects are enabled upon scene start, and both contain same objects. Root object have only one NetId's and no child NetId's are present.

    Everything is working properly when server and client start from the same project. Not separating them is not an option, since I need a clean project for the master server and a separate game server.


    Any ideas would be appreciated, because I've ran out of those.
     
  2. xVergilx

    xVergilx

    Joined:
    Dec 22, 2014
    Posts:
    3,296
    Ok, so I tried a clean scene setup with just my player object prefab spawning via connect/add player internal. Now I'm getting "Spawn scene object not found for 1".

    I love Unet. Is it prefab rebuilding time again?

    Edit: Okay, so that didn't worked.
     
    Last edited: Jun 23, 2017
  3. angusmf

    angusmf

    Joined:
    Jan 19, 2015
    Posts:
    261
    The net id is generated dynamically as the objects are started up, so they will potentially be different each time. I don't think it would matter that they are different projects because you should only be spawning the object one time, on the server, then that ID is replicated to the clients.
     
  4. xVergilx

    xVergilx

    Joined:
    Dec 22, 2014
    Posts:
    3,296
    I'm aware of that. However, the issue is that server somehow manages to spawn one object with Id X on the server, and pass data to completely different Y object on client, resulting in enabling Server only objects, messing up logic, etc.

    Maybe I somehow messed up spawn order of server by overriding OnServerAddPlayer and OnClientConnect methods via custom network manager. I don't know what's wrong though. I'll dig deeper today and try to find out what causing this behavior.

    Edit: I think I found the reason. There was an attached spawnable object to a NetworkManager by mistake, causing spawn failure.
     
    Last edited: Jun 26, 2017