I’m developing a network game with Unity. I need to test things a lot, so I followed the instructions in the documentation on how to run two instances of unity at once.
Now the problem is, as every client can be the server, the both client and server code and objects are in the same scene. This means for testing, I have to open two instances of Unity with the same project.
Of course this spelled trouble quite immediately (e.g. Unity forgetting the contents of my scene entirely after quitting, ouch). So I made a copy of the folder and set up a program to synchronize the folder of the copy with the original when something changes. So I can run one instance of Unity for each folder.
First I synched all folders, but the Temp folder seemed to give trouble, so I left that one away. Now still, it isn’t working very well - changes to prefabs aren’t updated (even when refreshing), and I can’t be quite sure if other things are updated properly either. Unity just takes what is in memory instead of what is on disk.
So, what I’d like to know is - how do you people write games like this? I don’t think you restart Unity before every test or never test…
Any advice on how to tackle this issue is highly appreciated (and I might not be the only one)!
I had been running to instances of Unity with copies for a while, and that worked more or less okay, but I had somewhat frequent crashes. I had one “master copy”, and then just copied the contents of that over to the “server copy” after each change (mostly only the scripts after code changes). Then, I got scared that I might be messing up my Unity installation and stopped doing this
So what I do now is start up either one of the clients or the server in the editor, and a couple of clients (and sometimes one server) as standalone apps. It’s not ideal, but it’s “pretty okay”.
i just build a standalone and test that as a client instance while running a server instance from unity. Since 2.1 you can see all of the logs from standalones, so you can easily see all of the error information, Debug.Log stuff, and so on. there’s a link to it in the Unity console thingy.
I’ve been running multiple instances for network development and found it to be fairly stable so long as you are only making changes to code. I’m doing my networking as the very first thing in my project, so there isn’t much else going on to trip up Unity.
When I do need to make changes in the Unity project, I will make all but one instance show the game as full screen, so I don’t end up making changes to separate instances of the scene.
I have my test computer on the same lan as my development computer, so I simply build and run an instance of my game on the development computer after which I launch the same application on my test computer - accessed via afp.