Description
When using the SIMPLE Unity Plugin, the Unity preview cannot be started if GAMA was already running before Webplatform was started with npm start.
In this scenario, Webplatform does connect to the GAMA server, but the SIMPLE Unity Plugin preview fails because no experiment appears to be selected or available. Unity then reports that the preview cannot be launched because no experiment is selected.
Based on the Webplatform logs, the issue does not seem to be a complete failure to connect to GAMA. The connection to the GAMA server is established successfully, but the failure happens later when Webplatform tries to create the Unity player inside GAMA.
Context
This happens in the workflow involving:
- GAMA
- SIMPLE Webplatform
- SIMPLE Unity Plugin
- Unity preview launch
The issue seems related to the startup order between GAMA and Webplatform.
Steps to reproduce
- Start GAMA.
- Open or select a valid experiment in GAMA.
- Start Webplatform:
- Open Unity with the SIMPLE Unity Plugin.
- Try to launch the preview from Unity.
Current behavior
The SIMPLE Unity Plugin preview cannot be launched.
Unity reports that no experiment is selected, so the preview cannot start.
However, starting Webplatform with npm start before launching GAMA seems to avoid the issue.
On the Webplatform side, the logs show that the connection to GAMA is successful:
sim·GamaConnector Connected to Gama Server on ws://localhost:1000
However, when Unity connects and Webplatform tries to create the Unity player in GAMA, GAMA returns an execution error:
sim·GamaConnector Error message received from Gama Server: {
type: 'UnableToExecuteRequest',
content: '> Error: Java error: nil value detected',
command: {
type: 'expression',
exp_id: '0',
expr: 'do create_player("unity_play_20260617073055_ce7165b7");'
}
}
After that, Webplatform repeatedly logs errors indicating that the Unity player cannot be found or is already dead:
Cannot find player with ID unity_play_20260617073055_ce7165b7 (dead)
There are also abnormal WebSocket closures related to the Unity player:
[Err 1006] Abnormal websocket closure with message: Received TCP FIN before WebSocket close frame
Expected behavior
The SIMPLE Unity Plugin should be able to launch the preview even if GAMA was started before Webplatform.
As long as a valid experiment is open or selected in GAMA, Webplatform should correctly retrieve or initialize the experiment context before the Unity preview starts.
The Unity player should then be created successfully in GAMA.
Actual behavior
Webplatform connects to GAMA, but the selected experiment or simulation context seems to be missing or not initialized when the SIMPLE Unity Plugin preview starts.
The command sent to GAMA fails:
do create_player("unity_play_20260617073055_ce7165b7");
GAMA returns:
Java error: nil value detected
Then the Unity player is disconnected or marked as dead, and the preview cannot continue.
Suspected cause
The problem seems to happen when the SIMPLE Unity Plugin preview triggers the player creation flow. At that point, Webplatform sends do create_player(...) to GAMA, but the GAMA-side experiment or simulation context appears to be nil.
Relevant logs
sim·GamaConnector Connected to Gama Server on ws://localhost:1000
multi·PlayerManager New connection of the player of id unity_play_20260617073055_ce7165b7
sim·GamaConnector Error message received from Gama Server: {
type: 'UnableToExecuteRequest',
content: '> Error: Java error: nil value detected',
command: {
type: 'expression',
exp_id: '0',
expr: 'do create_player("unity_play_20260617073055_ce7165b7");'
}
}
multi·PlayerManager Cannot find player with ID unity_play_20260617073055_ce7165b7 (dead)
multi·PlayerManager [Err 1006] Abnormal websocket closure with message: Received TCP FIN before WebSocket close frame
Suggested investigation
Check the initialization flow between Webplatform, GAMA, and the SIMPLE Unity Plugin when GAMA is already running before Webplatform starts.
The issue may be around the code path :
Before this command is sent, Webplatform should probably verify that the selected GAMA experiment and simulation context are available and valid.
If the experiment context is missing, Webplatform should either refresh it from GAMA or return a clearer error to the SIMPLE Unity Plugin instead of letting the player creation fail with nil value detected.
Description
When using the SIMPLE Unity Plugin, the Unity preview cannot be started if GAMA was already running before Webplatform was started with
npm start.In this scenario, Webplatform does connect to the GAMA server, but the SIMPLE Unity Plugin preview fails because no experiment appears to be selected or available. Unity then reports that the preview cannot be launched because no experiment is selected.
Based on the Webplatform logs, the issue does not seem to be a complete failure to connect to GAMA. The connection to the GAMA server is established successfully, but the failure happens later when Webplatform tries to create the Unity player inside GAMA.
Context
This happens in the workflow involving:
The issue seems related to the startup order between GAMA and Webplatform.
Steps to reproduce
Current behavior
The SIMPLE Unity Plugin preview cannot be launched.
Unity reports that no experiment is selected, so the preview cannot start.
However, starting Webplatform with
npm startbefore launching GAMA seems to avoid the issue.On the Webplatform side, the logs show that the connection to GAMA is successful:
However, when Unity connects and Webplatform tries to create the Unity player in GAMA, GAMA returns an execution error:
After that, Webplatform repeatedly logs errors indicating that the Unity player cannot be found or is already dead:
There are also abnormal WebSocket closures related to the Unity player:
Expected behavior
The SIMPLE Unity Plugin should be able to launch the preview even if GAMA was started before Webplatform.
As long as a valid experiment is open or selected in GAMA, Webplatform should correctly retrieve or initialize the experiment context before the Unity preview starts.
The Unity player should then be created successfully in GAMA.
Actual behavior
Webplatform connects to GAMA, but the selected experiment or simulation context seems to be missing or not initialized when the SIMPLE Unity Plugin preview starts.
The command sent to GAMA fails:
GAMA returns:
Then the Unity player is disconnected or marked as dead, and the preview cannot continue.
Suspected cause
The problem seems to happen when the SIMPLE Unity Plugin preview triggers the player creation flow. At that point, Webplatform sends
do create_player(...)to GAMA, but the GAMA-side experiment or simulation context appears to benil.Relevant logs
Suggested investigation
Check the initialization flow between Webplatform, GAMA, and the SIMPLE Unity Plugin when GAMA is already running before Webplatform starts.
The issue may be around the code path :
Before this command is sent, Webplatform should probably verify that the selected GAMA experiment and simulation context are available and valid.
If the experiment context is missing, Webplatform should either refresh it from GAMA or return a clearer error to the SIMPLE Unity Plugin instead of letting the player creation fail with
nil value detected.