简体   繁体   English

打不开LibGDX游戏第二个实例?

[英]Can't open a second instance of LibGDX game?

I'm currently developing a small multiplayer game for a university project using LibGDX in IntelliJ, but I'm running into an issue where I can't run more than one game at a time to test multiplayer functionality.我目前正在使用 IntelliJ 中的 LibGDX 为一个大学项目开发一个小型多人游戏,但我遇到了一个问题,我一次不能运行多个游戏来测试多人功能。

On executing the program the first time everything runs okay, but the second time I click run the process shows as running yet won't open a window until the first instance is closed.第一次执行程序时一切正常,但第二次单击运行时,进程显示为正在运行,但在第一个实例关闭之前不会打开 window。 I've gone into the build/run configurations and checked the "Allow parallel run" option, but it didn't seem to do anything.我已经进入构建/运行配置并检查了“允许并行运行”选项,但它似乎没有做任何事情。 Any idea what could be causing this?知道是什么原因造成的吗?

The problem is that your application is executed as a Gradle Run Task .问题是您的应用程序作为Gradle Run Task执行。 The task will wait for the exit code of the process and block all other tasks including run tasks.该任务将等待进程的退出代码并阻止所有其他任务,包括运行任务。 I don't know if parallel execution of run tasks is possible, but this workaround worked for me:我不知道是否可以并行执行运行任务,但这种解决方法对我有用:

  1. Swap the Build and run option from Gradle to native IntelliJ IDEA as described hereBuild and run选项从 Gradle 交换到本机 IntelliJ IDEA,如此所述
  2. Now reconfigure your run configuration.现在重新配置您的运行配置。 If you are using Kotin you need to create a new one如果您使用的是 Kotin,则需要创建一个新的

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM