Search Unity

  1. We are migrating the Unity Forums to Unity Discussions. On July 12, the Unity Forums will become read-only. On July 15, Unity Discussions will become read-only until July 18, when the new design and the migrated forum contents will go live. Read our full announcement for more information and let us know if you have any questions.

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).