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.

Client and server separated build

Discussion in 'Multiplayer' started by xDooKx, May 10, 2022.

  1. xDooKx

    xDooKx

    Joined:
    Apr 22, 2022
    Posts:
    2
    Hello, I'm new here and asking for your help :)

    I'm developing session-like game (like a escape from tarkov) and I don't want to give players able to host their own servers. So, my question is: how can I separate client code from server code using mirror, fishnet or new unity networking system?

    I searched for the info but found only mirror compiles server-side code with the client side (include all networking logic) and as I understood there is no way to separate it.
     
  2. luke-unity

    luke-unity

    Unity Technologies

    Joined:
    Sep 30, 2020
    Posts:
    306
    One way you can achieve this is via code stripping using compile directives. You can find an example here: https://docs-multiplayer.unity3d.com/blog/2021/06/01/webinar/#code-stripping

    This should work with any networking solution. If you want to completely split your code you can also put your files under different assembly definition files and have the entire assembly be stripped from a client/server build.
     
    OnatKorucu likes this.
  3. xDooKx

    xDooKx

    Joined:
    Apr 22, 2022
    Posts:
    2
    Many thanks, looks like exactly what I needed :)
     
  4. MichaelJT

    MichaelJT

    Joined:
    Jan 28, 2015
    Posts:
    10
    Page not found. :(
     
  5. cerestorm

    cerestorm

    Joined:
    Apr 16, 2020
    Posts:
    497
    Ik-Dev likes this.