Search Unity

Unet. How to make custom Ui to server that every client gets on start and visible only to him?

Discussion in 'Connected Games' started by tranos, Sep 7, 2019.

  1. tranos

    tranos

    Joined:
    Feb 19, 2014
    Posts:
    141
    Hello, I want to create a ui that gets created on server on runtime, that every client gets on start and is visible only to him and not synchronized to others. I am new to this subject and I can't get my head around. Any help will be appreciated.
     
  2. Joe-Censored

    Joe-Censored

    Joined:
    Mar 26, 2013
    Posts:
    6,340
    You wouldn't normally "create" the UI on the server. You pass some data from the server to the client, which the client uses to construct the UI. What data you pass depends on what in the UI you're trying to customize.
     
  3. tranos

    tranos

    Joined:
    Feb 19, 2014
    Posts:
    141
    @Joe-Censored You are right. Ι cannot build a prefab on runtime. I will build the base-prefab and customize it by sending a class object that will customize it. From what i ve read I must first serialize it with binary and send it as byte array.
     
    Last edited: Sep 10, 2019
  4. Joe-Censored

    Joe-Censored

    Joined:
    Mar 26, 2013
    Posts:
    6,340
    "must" isn't entirely true, but serializing as a byte array is usually the preferred way.