Search Unity

UNET Help : multiple players and shared object

Discussion in 'UNet' started by sami1592, Jul 24, 2019.

  1. sami1592

    sami1592

    Joined:
    Sep 18, 2013
    Posts:
    57
    Hello good people,

    For various reasons, I have started with UNET for my project, it's aimed at Hololens but for now I have started with PC just to get something running first.

    So, in my case I will have a common object, and each user should be able to modify the object; to be more specific, each user clicks on the object it will change color to reflect it is highlighted, upon clicking on buttons/pressing key the user should be able to translate and rotate this shared object etc

    Given this, I am not sure on how to design my game. My common shared object can't send
    Command
    functions to it's server versions since it is not a player, then how can it tell the server that user has taken some actions and it needs to change? Surely I am not getting something very basic here because it seems such a trivial thing to do.

    Question 1 : How can I design my scene given this scenario?
    Question 2 : The UNET tutorials are pulled down from the Unity website, where should I look for reference now?

    Thank you in advance for your help.
     
  2. Joe-Censored

    Joe-Censored

    Joined:
    Mar 26, 2013
    Posts:
    11,847
    Unet is deprecated, don't use it if there is any other option. Unet was never finished, lacking many features you'd expect if it had been. One of those is what I would call an "unsafe command", where clients could send a command to the server on a gameobject they don't own.

    The work around choices are to send the command instead on that client's special Player gameobject, or to instead use a Unet Message (which aren't actually associated with any specific object, so avoid any issues with object ownership).

    If you go the player object command route, the client would send the command, and on the server side you would find the correct gameobject, make the change, and propagate that change to all the clients. The Unet Message way would be similar, but instead of on the Player gameobject you'd do it in the handler for that message ID.

    There should still be 3rd party Unet tutorials on Youtube as long as their creators haven't removed them from their channels. Most people have moved on from Unet, so you're less likely to get help today on the forums than a couple years ago. If you can use Mirror that might be a better long term plan, since it is based on Unet.
     
    sami1592 likes this.
  3. sami1592

    sami1592

    Joined:
    Sep 18, 2013
    Posts:
    57
    Thank you for the reply.

    1. Thanks for the "Mirror" suggestion
    2. The approach you mentioned "If you go the player object command route, the client would send the command, and on the server side you would find the correct gameobject, make the change, and propagate that change to all the clients"; Thanks, I am doing it like that now.
    3. Do you know of any good tutorials for Unet?
     
  4. Joe-Censored

    Joe-Censored

    Joined:
    Mar 26, 2013
    Posts:
    11,847
    When I used Unet I just used the written documentation. You'll probably have to use the manual and scripting reference pages for older versions of Unity, since I notice Unity has begun purging Unet content. My understanding is the official tutorials have been removed (haven't checked, that's just what I've been told), so you'll probably need to find 3rd party tutorials which haven't been taken down.
     
    sami1592 likes this.