An article about
By Finn van der Heide.
Testing multiplayer games in Unity can be tricky. A well-known problem is that Unity does not allow you to have the same project open in two editors.
Of course it is possible to create a build to test the game, but to call that a good developer experience is going too far. Every change you make needs another build to test.
Code versioning systems such as GIT or SVN can provide an effective solution for testing multiplayer games in Unity. These systems allow you to clone the same project multiple times in different locations.
All you have to do is create a new clone of the project in a different location on your system.
|- It is easy to test different versions of the game against each other.
|- Synchronizing between projects can make the code versioning history messy.
Code versioning allows you to directly test multiplayer games in Unity without additional knowledge, programs or dependencies.
An alternative way for testing multiplayer games in Unity is to use symbolic links, also known as symlinks. These links act as transparent shortcuts for Unity, making it possible to run multiple instances of the same project without creating conflicts.
In this method, symlinks are created for the Assets, ProjectSettings and Packages folders. The remaining files and folders can be generated by Unity itself.
Open the Command Prompt or PowerShell and run the following commands. Remember to adjust the paths before running them.
mkdir "C:\target location"
mklink /j "C:\target location\Assets" "C:\source location\Assets"
mklink /j "C:\target location\ProjectSettings" "C:\source location\ProjectSettings"
mklink /j "C:\target location\Packages" "C:\source location\Packages"
As an alternative to creating symlinks manually, you can use Link Shell Extension. With this tool, you can easily select the source directory via the context menu (right mouse button) and then place the symlink on the target location as a "Hardlink".
Open the Terminal.app and run the following commands. Remember to adjust the paths before executing them.
mkdir "/target location"
ln -s "/source location/Assets" "/target location/Assets"
ln -s "/source location/ProjectSettings" "/target location/ProjectSettings"
ln -s "/source location/Packages" "/target location/Packages"
|- Full control of the project.
|- Risk of simultaneous changes in different editors that cannot both be saved.
Using symlinks, you can efficiently manage and test multiple versions of your Unity project, significantly improving your development workflow. It requires some technical knowledge, but the benefits in terms of flexibility and control are significant.
If the above methods seem too complex or risky, an alternative solution is available. ParrelSync is an open-source tool designed specifically to address this problem. It automates the process of creating symlinks, making it simpler and less error-prone.
ParrelSync integrates seamlessly with the Unity Editor and provides a user-friendly dropdown menu for managing your "clones." This allows you to easily set up and manage multiple versions of your project without having to manually create symlinks.
|- Includes built-in security measures to prevent you from accidentally making changes to a clone.
|- Adds additional dependencies to your game.
With ParrelSync, you can concentrate on developing and testing your game without worrying about the complexity of managing multiple project versions.
Testing multiplayer games in Unity can be challenging, but there are several methods available to facilitate this process. Code versioning, Symlinks and ParrelSync each offer their own advantages and disadvantages. At Wikkl, we generally use Symlinks. This method allows us to iterate and test modifications quickly without having to add additional dependencies to our project. It allows us to focus on what really matters: developing great multiplayer games. Regardless of the method you choose, the important thing is to find a solution that best fits your specific needs and workflow.
Developer and Producer
A creative developer with a passion for software development and gameplay. With a keen eye for what makes a successful product and a constant drive to learn and improve, Finn uses his technical expertise to tackle complex challenges and create dynamic experiences.