- Home /
Exclude server-sensitive code from client build
I have unet-based game, and have some server-side code, like random logic, Bussiness/DB logic, dll's, connectionString to DB, maybe cryptKeys, etc. The things which should not be in client build. How can I make this? To exclude code, libraries, files from client build. And to make even client code to not reference to aby of server related code (to not have situations when code expect dlls or classes, which not present in client build). I believe it's architecture related question, not just 'exclude code from project'.
Do you have a build/release pipeline configured? Do you use config files and transforms? Is all the information just sensitive configuration information?
Answer by YetAnotherKen · Aug 24, 2019 at 08:32 PM
Well, if you setup the client to be a separate application then you can control what goes into it. You could make use of Asynchronous Encryption which allows you to send a public encryption key to the client to use so it can communicate with the server. This key could not be used to compromise the Server's own private encryption key for it's own data.
In my project, due using of Unet, client and server are in same project. And because of this, server code may get in client build
How? AFAI$$anonymous$$ to use Unet both server and client should be in single project. And more of that, they should use single scene
Answer by Luminisc · Oct 04, 2019 at 05:15 PM
Found one of solutions. Creating one shared scene between server and client, and two separate scene for them. Now, when you are on client, you need to load shared scene and additively add client scene with client code. And so on for server, shared scene + server scene with server-only code.
So, for each instance (server and client) you build it with only needed scenes for exact type of instance. The one hot topic here is to use Code Stripping, to remove server-sensitive code from client.
Still not checked this approach, but looks like it will help.