- Home /
Launching multiple Unity games from a single "launcher" game
I have been looking into ways to launch existing Unity projects from a unified "launcher" Unity project and have run into a road block. My scenario is that I have 8 existing Unity projects that I would like to be able to launch from a single project using an interface somewhat like Steam Big Picture mode. The goal of this unified launcher is to have a nice clean interface that can be used when showing in person demos instead of going into the file system and launching each game individually.
From what I have found there are two main ways that this is possible:
merging all of the projects into a single project and building from there
using the -parentHWND command line argument with something like Process.Start() from the standard C# libraries
The first option is something I would like to avoid as it means having a single huge project that becomes hard to manage and maintain. The second option doesn't seem optimal as it means having to wait for Unity and everything else to load again.
Ideally I would like to do something similar to using asset bundles except with the ability to include scripts across projects in addition to the assets but as far as I can tell that isn't possible.
Is there a way to load other Unity games across projects from a single "launcher" style application without having to merge all of the projects together or have multiple instances of Unity running at the same time?
@ssamoil, Did you solve this? I am trying to do something similar.
Answer by JohnCraigFreeman · Jun 10, 2017 at 07:48 AM
@ssamoil, Did you solve this? I am trying to do something similar.
Unfortunately I didn't find a reasonable solution. From all the searching I did it looks like this isn't possible. I ended up just doing a basic non-Unity launcher that manages all of our applications in a way similar to the S$$anonymous$$m library.
Thanks ssamoil, This seems like such a basic functionality. How would we get someone from Unity to reply? I asked the following question in the 'Questions' forum:
Launch another Unity game C# script I am trying to write a C# script which will launch another Unity game when the character collides with a trigger. Can anyone provide and example?
I'm not sure how to get a hold of someone directly. I suppose this issue is basically why there are scenes but that doesn't solve the issue of avoiding an extremely cluttered project when the number of merged projects becomes unmanageable.
If there isn't an issue with the Unity splash screen showing in your case you could always just use the Process.Start() function but that looks and feels really hacky and far from ideal.
Answer by tmarshall619 · Jun 13, 2017 at 03:32 PM
@ssamoil This isn't really optimum but if the games that you are trying to launch are your own ( or you have access to the source code) then you could make a build that compiles them all into a sort of super game where the "hub" is a scene with options to load the initial scenes of each of the games. Like I said, not optimal, but maybe a short term work around.
I've tried this without success. They are all my games. They are just so big, they won't build in one if I try to do it all at once. So I want to be able to move from game to game. Here is what I have.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using System.Diagnostics;
public class Launch_Virtual_Wuhan_01_Script : $$anonymous$$onoBehaviour {
void OnTriggerEnter(Collider other) {
System.Diagnostics.Process.Start("Virtual_Wuhan_01.exe");
}
}
That looks about right to me. What happens when this code executes? The one exception I can think of is it might not know where to find the .exe. The examples that I found deal with applications that are probably in the the default install directories for windows. You might research how to direct that function call to a particular director so that it can find the executable. The best place to keep that would probably be in your Hub's build-data folder.
https://docs.unity3d.com/ScriptReference/Application-dataPath.html @JohnCraigFreeman That returns the path that Unity starts looking in, which should be the corresponding data folder in the build folder for the project. If you organize your other games inside of the data folder you should be able to navigate to them using something like Application.datapath+"\yourSubDirectory\OrExecutableHere"
Oh! Of course. Awesome, I'll try that. Thanks
Hi tmarshall619, thank you for the response. Unfortunately I had tried something along the lines of what is being discussed in the comments (Process.Start()) and it still results in a new Unity instance being started up (with the whole splash screen and everything). The other issue I have run into is that since I am working on a VR application it means that context switching between processes isn't supported (both the Rift and the Vive do not allow it, they require all VR applications be shut down before starting a new one).
I had hoped to avoid doing a "super game" as you say because it results in a massive project and merging the existing projects could be a bit of an nightmare with conflicts in filenames, class names, etc.
I agree, that would be pretty troublesome. VR in particular does complicate things. Honestly, I don't know how many options are out there if you are trying to avoid the splash screens and the issues associated with loading a new application in VR. That would be a lot of pretty complex ground up work.
Your answer
Follow this Question
Related Questions
2D TileZone (not lite) 0 Answers
I can't Kill or Close the external exe that i already opened from the unity exe ? 0 Answers
Updating Unity stuff is overwriting scripts I've previously edited? 1 Answer
Unity Editor not finding assets after updating to macOS 10.13? 10 Answers
Why my Assets not loaded twice from the asset Bundle? 1 Answer