8

What do I mean by two game windows in the Unity Editor?

Well if one could basically be able to have two separate windows inside the editor instead of being limited to having just one:

Why would this be useful?

It's mostly useful for networking. When testing a networked multiplayer game, normally one would have to wait a long time to create a standalone build to test and debug events, plus debugging errors on standalone is hard.

If I could just run two instances (one server/ one client) on the click of the play button I would save so much time.

This is a game window btw https://i.gyazo.com/2aeb04f8a41f1508d262cf9a526311bc.png

Isaak Eriksson
  • 633
  • 1
  • 7
  • 16
  • (1) You absolutely can't do that. What you do is simply this: build one version as an actual desktop app to your Mac (or PC). Then use that one, and, the one "in the Editor". – Fattie Jun 01 '16 at 22:27
  • (2) Note that for this reason, anyone who does multiplayer development, has two or three machines on their desk. It's depressing but that's how it is. – Fattie Jun 01 '16 at 22:27
  • (3) "plus debugging errors on standalone is hard" I can help you there. you ***absolutely must*** carefully set up systems that show you development messages, and so on, on the screen of the device. (AND make sure you know how to watch the logs when it's playing on a device, google for it.) – Fattie Jun 01 '16 at 22:28

3 Answers3

3

If you are trying to test networking code, having multiple "game windows" open won't actually allow you to do that. If you have multiple copies of the project on your computer you can open multiple instances of unity. (unity puts a lock file in each project so you can't just open it twice using the same files)

Downside to this is that if you make changes in one project, you have to copy/redo that change in the copy of the project. But certainly faster than building and you can connect debuggers to both instances of unity

Colton White
  • 976
  • 5
  • 17
  • I gave it a shot and it seems to work, although I'm not quite sure what is the best solution to sync the projects together, github? https://i.gyazo.com/205b76642ebafd2e6f5602f927224dcb.gif – Isaak Eriksson Jun 02 '16 at 07:03
  • Yea any sort of version control system should work (git,svn, mercurial, etc). It may be possible to do it just using a local git repo to sync locally without having to use github, this answer my help http://stackoverflow.com/questions/4860166/how-to-synchronize-two-git-repositories – Colton White Jun 02 '16 at 14:15
  • Unless your client and server apps are going to just be two different copies of the same project, you can use robocopy and Unity command line arguments to automate the process of copying the project. Using this method, you can eliminate the need of a version control branch for your "client" project copy: – user1751117 May 22 '17 at 14:57
  • SET projectPath=%cd%\..\CardGameMoba2 robocopy "..\CardGameMoba" "..\CardGameMoba2" /mir /R:0 /W:0 tasklist /nh /fi "imagename eq Unity.exe" 2>nul | find /C "Unity.exe" > deleteme.txt SET /p unityInstances= – user1751117 May 22 '17 at 14:57
2

You can create multiple directories and link "Assets", "Packages" and "ProjectSettings" from the origin to your copies. then all your changes are applied to all instances.

on windows: "mklink /d target source" on mac: "ln -s source target"

you still have to apply a few settings in each instance ( like selected platform )

PS: make sure you modify your unique identifier in each copy instance to be able to act as different user/account. this should editor only and can help switch accounts to test different right/behavior

Puschie
  • 138
  • 9
1

There are a couple of great assets on the unity asset store. Dual Play for example is free and does the job nicely! Dual play

Spark
  • 27
  • 5