NICE! I love Unity because you can do this stuff SO easily. I have done it MANY times with my own apps and with commercial apps as well.
I call it Operation Chimera whenever I combine apps.
Some steps to consider:
-
use source control. Don’t even attempt it without source control.
-
prepare each project FIRST… since you wrote both, they probably share some code, so isolate that code into separate folders within the game:
→ the game code
→ the shared code
-
apply namespaces to the game portions of the code, and if you like, add a namespace to the shared code too. This is optional and depends on how divergent your shared code is.
-
still before combining them, move each game into uniquely-named folders within itself (GameA and GameB) for instance.
4a. Harmonize shared stuff like tags, layers, sorting layers, physics settings, and any other engine-specific stuff you fiddled. By “harmonize” I mean “adjust both projects to separately use a superset of the shared features.”
-
Create a new empty destination project, or pick one project as the final resting spot.
-
Close Unity, then copy the ENTIRE contents of the Assets/ folder from both games into one project.
-
Commit ALL of this to source control NOW!! If you don’t do this, you’re not being serious. It’s the only way to make forward progress when things get complicated.
-
Now open Unity. Pay attention to the console, looking for collisions in GUIDs. If there are, write them down. You will potentially need to fix any prefabs that use these scripts.
After that it is just patching and fixing and fiddling, dupe classes, bugs etc.
Here is the skinny on how Unity connects stuff:
SCRIPTS OR ASSETS ARE MISSING OR BLANK
ALWAYS move all Unity assets by using the Unity Editor. Any other way risks disconnecting the GUID in the meta file from the original file, and this will result in all connections to that asset being broken.
Some info about Missing script warnings, broken prefabs, GUIDs, renaming GUIDs, etc:
https://discussions.unity.com/t/836322/2
https://discussions.unity.com/t/815173/7
https://discussions.unity.com/t/815173/9
EVERYTHING in Unity is connected to the above GUID, which is stored ONLY in the metafile, and hence why the metafiles ALWAYS MUST be source-controlled.
When Renaming: It is super-easy to inadvertently change the GUID by renaming outside of Unity. Don’t do that. Instead:
- close Visual Studio (important!)
- rename the file(s) in Unity
- in Unity do Assets → Open C# Project to reopen Visual Studio
- now rename the actual classes, and MAKE SURE THE FILE NAMES DO NOT CHANGE!
If you are NOT using source control while you do this, renaming files is an EXTREMELY dangerous process. Use source control at all times so that you can trivially revert if you miss a critical step and damage your project.