Developing Client/Server in same project?

If I’m making a client/server game, is there any drawback to using the same project and only including the scenes for the client or the server when building?

Will Unity only compile the scripts/assets included in the actual scenes? Or does it compile everything?

If I have the art assets included in the actual project but unused in the scenes included, would those be included in the file size, or left out?

I’m doing it kind of that way, and for me, it works fine. I think it may be easier to actually have the same scenes for client and server and just load the stuff you don’t need on the server only on the client. What I’m doing is the other way round: I first load everything on the server and then I destroy everything that I don’t need. Not the most elegant solution but much easier to implement. I might have to reconsider this to optimize for mobile devices (there, I probably can’t really afford loading too much stuff I don’t really need - so far, it works but it’s just not nice).

Regarding compilation: Unity will compile all scripts and include them. With assets, I think it only includes what’s referenced in the scenes and what you put into Resources-folders. You might consider doing conditional compilation so that you remove some of the server-logic from your game clients (you really don’t want to deliver the server code to your clients, do you? :wink: ).

I’m currently working on a little editor extension that helps with that for the Asset Store (it’s basically what I’m already using in my project but I need to polish it up quite a bit before putting on the Asset Store).

I don’t think you should implement your server with Unity. There are plenty of socket servers available (Photon or SmartFox come to mind) that you could be using instead.

Those socket servers will be much easier to scale, and will alleviate the burden of having to run Windows on your servers.

Actually, you can use Photon and still use a Unity game server for stuff that’s best done in Unity. And while a Unity game server currently runs on Windows and Mac, until Linux support is implemented for Photon, Photon does bind you to Windows (which I personally don’t consider a problem, though I’m a very happy Photon user :wink: ).