Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

How useful are the UNet components?

Discussion in 'UNet' started by jister, Mar 13, 2016.

  1. jister

    jister

    Joined:
    Oct 9, 2009
    Posts:
    1,749
    Hey I'm starting on a small basic MP testing project.
    Now of course I could mash up something working with all the UNet components in about 10 min...

    But... :) I'm use to working with serialized classes and code objects rather than components and prefabs.

    So my first doubt about UNet is the managers spawn system... My player's model will be loaded when a player creates it's player and chooses which model he wants to be... (female/male/...)

    so anyhow will i end up just writing my own system or can i stick with all the UNet components?
    I see that most people also write their own NetworkSync and complain about the NetworkTransform.

    Thanks for sharing your experience using UNet.
     
  2. sovium

    sovium

    Joined:
    Mar 8, 2016
    Posts:
    27
    UNet works for most cases since you can override a lot of the stuff that the components do by default. A tricky part is that the documentation is not very thorough so you'll often find yourself wondering what something really does. Luckily the Networking module is open source, so you can see what all of the premade Networking components really do in the background (https://bitbucket.org/Unity-Technologies/networking).

    However, if you are used to low level programming I would probably stick to that and take a look at the NetworkTransport layer in unity which is the Low Level API (LLAPI).

    Personally I would definitely go as low level as possible to help myself understand what happens where since Networking is rather tricky to say the least. I am still learning stuff, but this is my opinion.
     
  3. jister

    jister

    Joined:
    Oct 9, 2009
    Posts:
    1,749
    @sovium thanks for the link, I'll read up on it.
    but still doubting what would take less time, figuring out the UNet components and learn their ups and downs or just straight away start writing my own system (using their [syncvar], [command], [clientcallback] and other goodies that came with the new network system)
     
    sovium likes this.
  4. sovium

    sovium

    Joined:
    Mar 8, 2016
    Posts:
    27
    Yeah, personally I find it easiest to use the High Level API, but not the network manager, just the ClientScene, NetworkServer, NetworkClient, SyncVar, Command, etc. In case I need something really custom, I might pop a few NetworkMessages here and there, but so far this has been sufficient for my needs.
     
  5. jister

    jister

    Joined:
    Oct 9, 2009
    Posts:
    1,749
    well first problem I'm running into is the network identity.
    I have a template prefab for the player with some transforms inside to place a head or a body or,...
    this Template has my NetworkPlayer script attached which inherits from NetworkBehaviour... which automatically adds a network identity...
    and so my prefab gets disabled as long as there is no connection to a network :-(
    the building of the character doesn't need a network! but i'd like to set character values in the script...
    Guess I'll split up a Player and a Network Player.
     
  6. sovium

    sovium

    Joined:
    Mar 8, 2016
    Posts:
    27
    Yeah creating a character with multiple nested transforms might be problematic especially if you need to move them individually and network those movements. If you pull this off, I am interested in how you did it so please share your process if you can.
     
  7. jister

    jister

    Joined:
    Oct 9, 2009
    Posts:
    1,749
    Well they wouldn't need to sync individually, in the end they will just be children of a rig used for all characters. so animation will take care of the rest (guess i need to update my animation to the server at some point)
    for now I'm stuck at the same thing i often encounter, save/load/update a changed prefab. I guess I'll find a nice way to handle this once and for all.
    I'm use to Save/Load with binaryFormatter which as you probably know doesn't work with UnityEngine.Objects...
     
    sovium likes this.