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

Question Separated server NuGets

Discussion in 'Multiplayer' started by adeutscher, Nov 18, 2023.

  1. adeutscher

    adeutscher

    Joined:
    Sep 14, 2020
    Posts:
    1
    Hello all,

    I'm planning a Unity project that uses a client/server setup.

    At some point in the process I will want to sanitize the client to not include server logic, and I see that I can use pre-processing directives as described in Unity documentation to filter out certain C# code. The wrinkle is that the server shall be using some NuGet packages to access back-end APIs that I would also like to omit from a sanitized client build.

    I understand that I can have Editor/Unit-Test-land-only NuGet packages (such as if I wanted to use Moq) by putting the DLLs within an Editor directory, but is there a similar option available to include/exclude certain DLLs on certain types of release builds?

    If there is not such a setting, then my Plan B is described in the bullet points below. If they are even necessary, do these steps sound reasonable?
    • Server-only NuGets would be placed in a separate directory from any client NuGets that I might use. This will either need me to go manual with my DLL placement or make a fork of one of the NuGet support plugins to have some kind of an "Install for Server" button.
    • Sanitized builds would go off of a fresh checkout of the project so that I can do destructive things.
    • The server-only plugin directory would be deleted, and any code that would miss the DLLs would be walled off behind preprocessor directives (or deleted as well, if I'm being destructive anyways).