I am making a project in which i want to open and start a game in unity when a button is clicked on a windows form app. So is there a solution for this problem?
I am making a project in which i want to open and start a game in unity when a button is clicked on a windows form app. So is there a solution for this problem?
I'm assuming that you know how to build it: https://docs.unity3d.com/Manual/PublishingBuilds.html
So you need to do 3 (one optional) things:
void btnButton_Click(object sender, EventArgs e)
{
Process.Start("cmd.exe", "/k C:\path_to_game\start.exe")
}
You can use the Process class to bootstrap a new process:
Process.Start(@"D:\GameLocation\game.exe");
This, of course, hinges on the assumption that you have already built the game, and have an executable that you can call.
private void Button1_Click(object o, EventArgs eA)
{
Process.Start("C:\\my_unity_game_location\mygame.exe");
}
Here Button1 is the button which is present on your WinForm and Button1_Click is the event which is assigned to that Button1