Skip to content

[Bug]: Unity vient d'être ouvert, package installé, idem pour GAMA et webplatform, tout est à jour, et un play mode lancé dans l'ordre ne fonctionne pas #3

Description

@FlorianBarbe

Bug area

Play Mode runtime

Severity

Blocker - cannot use the plugin

Reproducibility

Sometimes

Workflow step where the issue happens

  • I installed the package from Git URL
  • I installed the package from a local folder
  • I opened GAMA > GAMA Panel
  • I clicked Setup Scene
  • I started simple.webplatform manually
  • I started GAMA
  • I opened or selected a GAMA experiment
  • I converted the experiment to a vr_xp experiment
  • I pressed Play in Unity
  • I generated a static preview from GAMA
  • I modified species settings
  • I configured dynamic colors from GAMA attributes
  • I applied settings and restarted Play Mode

Unity version

6000.3.2.f1

SIMPLE Unity Plugin version / branch / commit

branche distante main

GAMA version

No response

simple.webplatform branch / commit

dev

Operating system

Windows

Package installation method

Git URL

GAMA model and experiment

voici le model gama en entier et jai bien sélectionnéla versionn VR convertie par le GAMA Unity Pluginmodel MoussaidModel_model_VR

import "pedestrian.gaml"

species unity_linker parent: abstract_unity_linker {
string player_species <- string(unity_player);
int max_num_players <- 1;
int min_num_players <- 1;
unity_property up_wall;
unity_property up_default;
unity_property up_pedestrian;
list init_locations <- define_init_locations();

list<point> define_init_locations {
	return [{2.0, 2.0, 0.0}];
}

init {
	do define_properties;
	player_unity_properties <- [up_default];
	do add_background_geometries(wall, up_wall);
}

action remove_pedestrian(string id) {
	list<pedestrian> matched_pedestrians <- pedestrian where (each.name = id);
	if not empty(matched_pedestrians) {
		ask first(matched_pedestrians) {
			do delete;
		}
	}
}

action define_properties {
	unity_aspect wall_aspect <- geometry_aspect(3.0, #gray, precision);
	up_wall <- geometry_properties("wall", "", wall_aspect, new_geometry_interaction(true, false, false, []), false);
	unity_properties << up_wall;

	unity_aspect default_aspect <- geometry_aspect(1.0, #gray, precision);
	up_default <- geometry_properties("default", "", default_aspect, #no_interaction, false);
	unity_properties << up_default;

	unity_aspect pedestrian_aspect <- prefab_aspect("Prefabs/Visual Prefabs/Character/LittleGhost", 0.5, 0.2, -1.0, 90.0, precision);
	up_pedestrian <- geometry_properties("pedestrian", "pedestrian", pedestrian_aspect, #ray_interactable, false);
	unity_properties << up_pedestrian;
}

reflex send_geometries {
	do add_geometries_to_send(pedestrian, up_pedestrian);
}

}

species unity_player parent: abstract_unity_player {
float player_size <- 1.0;
rgb color <- #red;
float cone_distance <- 10.0 * player_size;
float cone_amplitude <- 90.0;
float player_rotation <- 90.0;
bool to_display <- true;
float z_offset <- 2.0;
aspect default {
if to_display {
if selected {
draw circle(player_size) at: location + {0, 0, z_offset} color: rgb(#blue, 0.5);
}
draw circle(player_size / 2.0) at: location + {0, 0, z_offset} color: color;
draw player_perception_cone() color: rgb(color, 0.5);
}
}
}

experiment vr_xp parent: "corridor_xp" autorun: false type: unity {
float minimum_cycle_duration <- 0.1;
string unity_linker_species <- string(unity_linker);
list displays_to_hide <- ["map"];
float t_ref;

action create_player(string id) {
	ask unity_linker {
		do create_player(id);
	}
}

action remove_player(string id_input) {
	if not empty(unity_player) {
		ask first(unity_player where (each.name = id_input)) {
			do die;
		}
	}
}

output {
	display map_VR parent: map {
		species unity_player;
		event #mouse_down {
			float t <- gama.machine_time;
			if (t - t_ref) > 500 {
				ask unity_linker {
					move_player_event <- true;
				}
				t_ref <- t;
			}
		}
	}
}

}

Expected behavior

Les objets doivent être importés et affichés dans Unity mais rie ne e passe ni ne s'affiche, et il y a même un popup Unity qui me demande si je veux fermer l'experiment GAMA actuellement sélectionné.

Actual behavior

Image Image

Dans ces deux screens on voit bien ce qui se passe dans Unity au noveau des pop-ups qui me sont donnés à voir.

Les objets doivent être importés et affichés dans Unity mais rie ne e passe ni ne s'affiche, et il y a même un popup Unity qui me demande si je veux fermer l'experiment GAMA actuellement sélectionné.

Steps to reproduce

On a les 3 fenêtres prêtes les unes a coté des autres
On fait npm start pour démarrer la webplatform
Elle démarre bien
Ensuite on ouvre l'experiment GAMA
Ensuite on fait play dans Unity et on a l'erreur : un pop-up qui nous propose de fermer l'experiment que j'ai sélectionner "surement pour en ouvrir u autre alors que je ne l'ai pas du tout demandé)
Je fais non bien entendu car je veux ben lancer l'experiment que j'ai sélectionné et pas un autre
Ca rame pendant 5 min et au final ça met le play mode dans Unity avec aucun objet rien du tout et pendant ce temps rien ne s'est passé dans GAMA

Et si je choisis oui pur changer d'experiment il me lance celui ci qui est traffic and pollution VR
Image
Et j'ai ce popup dans Unity avec un script appelé pendant 5 min
Image
Ensuite jai bien cet experiment qui se lance coté GAMA et le play mode qui se fait dans Unity sauf qu'aucun objet n'est importé et affiché là encore
Image

En fait jai bien compris d'ou venait le probleme : quand je lance la middleware pour la premiere fois sans avoir encore fais un seul playmode, et que j'ouvre l'experiment, y a aucun aperçu de player dans l'aperçu de l'experiment coté GAMA, car aucun player n'a encore été créé donc la webplatform ne met pas de player. Quand k'essaie de lancer depuis Unity dans cette configuration, il doit donc y avoir un fallback dans le script du package pour essayer de répondre ç ce cas en lançant un autre experiment, ce qui n'a absolument aucun sens. Le fait est qu'apres que jai eu ce probleme et que je reste dans la meme session de la webplatform, j'oiuvre un experiment et l'aperçu du player apparait car le joueur a alors été créé : dans ce cas lorsque je réessaie le play dans Unity tout marche bien!

Stack status when the issue happened

  • Unity was open
  • Unity Console had no compile errors
  • simple.webplatform was running
  • GAMA was running
  • GAMA experiment was open or selected
  • GAMA experiment was already running
  • Unity was connected to ws://localhost:8080/
  • Monitor WebSocket ws://localhost:8001/ was reachable
  • GAMA Server ws://localhost:1000/ was reachable
  • Runtime agents appeared under [GAMA] Runtime Live Agents
  • Static preview appeared in Edit Mode

Ports and endpoints

No response

Species settings involved

No response

Logs and error messages

Middleware logs : 
PS C:\Users\flole\Desktop\simple.webplatform> npm start

> simple.webplatform@4.0.0 start
> concurrently "npx tsx src/api/index.ts" "vite"

(node:37252) [DEP0060] DeprecationWarning: The `util._extend` API is deprecated. Please use Object.assign() instead.
(Use `node --trace-deprecation ...` to show where the warning was created)
[1]
[1]   VITE v7.3.2  ready in 570 ms
[1]
[1]   ➜  Local:   http://localhost:8000/
[1]   ➜  Network: http://192.168.64.37:8000/
[0]  info    core·index           Starting the SIMPLE Webplatform !
[0]  info    monitor·MonitorServ... Creating monitor server on: ws://0.0.0.0:8001
[0]  warning simulation·ModelMan... Couldn't find settings file in folder C:\Users\flole\Desktop\simple.webplatform\learning-packages
[0]  warning simulation·ModelMan... Couldn't find settings file in folder C:\Users\flole\Gama_Workspace
[0]  warning simulation·ModelMan... Couldn't find settings file in folder C:\Users\flole\Gama_Workspace\.cache
[0]  warning simulation·ModelMan... Couldn't find settings file in folder C:\Users\flole\Gama_Workspace\.metadata
[0]  warning simulation·ModelMan... Couldn't find settings file in folder C:\Users\flole\Gama_Workspace\exercice
[0]  warning simulation·ModelMan... Couldn't find settings file in folder C:\Users\flole\Gama_Workspace\Football
[0]  warning simulation·ModelMan... Couldn't find settings file in folder C:\Users\flole\Gama_Workspace\test2
[0]  warning core·Controller      Couldn't find ADB working or started, cancelling ADB management
[0]  info    multi·PlayerManager  Creating monitor server on: ws://0.0.0.0:8080
[0]  info    core·Controller      Not running on M2L2 (Mac Mini) hardware — skipping UPS connection
[0]  info    core·Controller      Session timer started — shutdown sequence armed for 3h if on battery
[0]  info    sim·GamaConnector    Connected to Gama Server on ws://localhost:1000
[0]  info    sim·GamaConnector    Checking for a GAMA experiment (id 0) not launched by the platform...
[0]  error   multi·PlayerManager  Cannot find player with ID unity_play_20260720043442_423015ff}
[0]  warning multi·PlayerManager  Can't remove un-existing player undefined
[0]  error   monitor·MonitorServ... [ERR 1006] Message too big!
[0]  error   monitor·MonitorServ... Message : ArrayBuffer {
[0]                                 (detached),
[0]                                 [byteLength]: 0
[0]                               }
[0]  error   monitor·MonitorServ... Message size: 45 bytes
[0]  error   monitor·MonitorServ... [ERR 1006] Message too big!
[0]  error   monitor·MonitorServ... Message : ArrayBuffer {
[0]                                 (detached),
[0]                                 [byteLength]: 0
[0]                               }
[0]  error   monitor·MonitorServ... Message size: 45 bytes

voici les logs Unity : [GAMA][CONNECTION][ID] Runtime player id=unity_play_20260720043442_423015ff
UnityEngine.Debug:Log (object)
GamaLog:Dev (string) (at C:/Users/flole/SIMPLE-Unity-Plugin/Runtime/Utils/GamaLog.cs:23)
ConnectionManager:Awake () (at C:/Users/flole/SIMPLE-Unity-Plugin/Runtime/Connection/ConnectionManager.cs:47)

[GAMA] SimulationManager initialized
UnityEngine.Debug:Log (object)
GamaLog:Dev (string) (at C:/Users/flole/SIMPLE-Unity-Plugin/Runtime/Utils/GamaLog.cs:23)
SimulationManager:Awake () (at C:/Users/flole/SIMPLE-Unity-Plugin/Runtime/Simulation/SimulationManager.cs:328)

[GAMA][RUNTIME][CONNECTION] subscribed to ConnectionManager
UnityEngine.Debug:Log (object)
GamaLog:Dev (string) (at C:/Users/flole/SIMPLE-Unity-Plugin/Runtime/Utils/GamaLog.cs:23)
SimulationManager:TrySubscribeConnectionManager () (at C:/Users/flole/SIMPLE-Unity-Plugin/Runtime/Simulation/SimulationManager.cs:4862)
SimulationManager:Awake () (at C:/Users/flole/SIMPLE-Unity-Plugin/Runtime/Simulation/SimulationManager.cs:330)

[GAMA][CONNECTION][START] url=ws://localhost:8080/
UnityEngine.Debug:Log (object)
GamaLog:Dev (string) (at C:/Users/flole/SIMPLE-Unity-Plugin/Runtime/Utils/GamaLog.cs:23)
WebSocketConnector/<Start>d__14:MoveNext () (at C:/Users/flole/SIMPLE-Unity-Plugin/Runtime/Connection/WebSocketConnector.cs:62)
System.Runtime.CompilerServices.AsyncVoidMethodBuilder:Start<WebSocketConnector/<Start>d__14> (WebSocketConnector/<Start>d__14&)
WebSocketConnector:Start ()

[GAMA][CONNECTION][OPEN]
UnityEngine.Debug:Log (object)
GamaLog:Dev (string) (at C:/Users/flole/SIMPLE-Unity-Plugin/Runtime/Utils/GamaLog.cs:23)
WebSocketConnector:<Start>b__14_0 () (at C:/Users/flole/SIMPLE-Unity-Plugin/Runtime/Connection/WebSocketConnector.cs:67)
NativeWebSocket.WebSocket/<Connect>d__27:MoveNext () (at C:/Users/flole/SIMPLE-Unity-Plugin/Runtime/ThirdParty/NativeWebSocket/WebSocket/WebSocket.cs:472)
UnityEngine.UnitySynchronizationContext:ExecuteTasks ()

[GAMA][CONNECTION][OPEN] id=unity_play_20260720043442_423015ff
UnityEngine.Debug:Log (object)
GamaLog:Dev (string) (at C:/Users/flole/SIMPLE-Unity-Plugin/Runtime/Utils/GamaLog.cs:23)
ConnectionManager/<HandleConnectionOpen>d__32:MoveNext () (at C:/Users/flole/SIMPLE-Unity-Plugin/Runtime/Connection/ConnectionManager.cs:92)
System.Runtime.CompilerServices.AsyncVoidMethodBuilder:Start<ConnectionManager/<HandleConnectionOpen>d__32> (ConnectionManager/<HandleConnectionOpen>d__32&)
ConnectionManager:HandleConnectionOpen ()
WebSocketConnector:<Start>b__14_0 () (at C:/Users/flole/SIMPLE-Unity-Plugin/Runtime/Connection/WebSocketConnector.cs:68)
NativeWebSocket.WebSocket/<Connect>d__27:MoveNext () (at C:/Users/flole/SIMPLE-Unity-Plugin/Runtime/ThirdParty/NativeWebSocket/WebSocket/WebSocket.cs:472)
UnityEngine.UnitySynchronizationContext:ExecuteTasks ()

[GAMA][CONNECTION][MESSAGE] type=json_state length=210
UnityEngine.Debug:Log (object)
GamaLog:Dev (string) (at C:/Users/flole/SIMPLE-Unity-Plugin/Runtime/Utils/GamaLog.cs:23)
WebSocketConnector:LogReceivedMessage (string) (at C:/Users/flole/SIMPLE-Unity-Plugin/Runtime/Connection/WebSocketConnector.cs:193)
WebSocketConnector:<Start>b__14_1 (byte[]) (at C:/Users/flole/SIMPLE-Unity-Plugin/Runtime/Connection/WebSocketConnector.cs:75)
NativeWebSocket.WebSocket:DispatchMessageQueue () (at C:/Users/flole/SIMPLE-Unity-Plugin/Runtime/ThirdParty/NativeWebSocket/WebSocket/WebSocket.cs:637)
WebSocketConnector:Update () (at C:/Users/flole/SIMPLE-Unity-Plugin/Runtime/Connection/WebSocketConnector.cs:136)

[GAMA] Connected to simple.webplatform.
UnityEngine.Debug:Log (object)
GamaLog:Dev (string) (at C:/Users/flole/SIMPLE-Unity-Plugin/Runtime/Utils/GamaLog.cs:23)
ConnectionManager:UpdateConnectionState (ConnectionState) (at C:/Users/flole/SIMPLE-Unity-Plugin/Runtime/Connection/ConnectionManager.cs:71)
ConnectionManager:ManageMessage (string) (at C:/Users/flole/SIMPLE-Unity-Plugin/Runtime/Connection/ConnectionManager.cs:158)
WebSocketConnector:<Start>b__14_1 (byte[]) (at C:/Users/flole/SIMPLE-Unity-Plugin/Runtime/Connection/WebSocketConnector.cs:76)
NativeWebSocket.WebSocket:DispatchMessageQueue () (at C:/Users/flole/SIMPLE-Unity-Plugin/Runtime/ThirdParty/NativeWebSocket/WebSocket/WebSocket.cs:637)
WebSocketConnector:Update () (at C:/Users/flole/SIMPLE-Unity-Plugin/Runtime/Connection/WebSocketConnector.cs:136)

[GAMA] Connected to simple.webplatform.
UnityEngine.Debug:Log (object)
GamaLog:Info (string) (at C:/Users/flole/SIMPLE-Unity-Plugin/Runtime/Utils/GamaLog.cs:16)
SimulationManager:HandleConnectionStateChanged (ConnectionState) (at C:/Users/flole/SIMPLE-Unity-Plugin/Runtime/Simulation/SimulationManager.cs:4802)
ConnectionManager:UpdateConnectionState (ConnectionState) (at C:/Users/flole/SIMPLE-Unity-Plugin/Runtime/Connection/ConnectionManager.cs:83)
ConnectionManager:ManageMessage (string) (at C:/Users/flole/SIMPLE-Unity-Plugin/Runtime/Connection/ConnectionManager.cs:158)
WebSocketConnector:<Start>b__14_1 (byte[]) (at C:/Users/flole/SIMPLE-Unity-Plugin/Runtime/Connection/WebSocketConnector.cs:76)
NativeWebSocket.WebSocket:DispatchMessageQueue () (at C:/Users/flole/SIMPLE-Unity-Plugin/Runtime/ThirdParty/NativeWebSocket/WebSocket/WebSocket.cs:637)
WebSocketConnector:Update () (at C:/Users/flole/SIMPLE-Unity-Plugin/Runtime/Connection/WebSocketConnector.cs:136)

[GAMA][RUNTIME][BOOTSTRAP] create_player attempt 1/20 id=unity_play_20260720043442_423015ff
UnityEngine.Debug:Log (object)
GamaLog:Dev (string) (at C:/Users/flole/SIMPLE-Unity-Plugin/Runtime/Utils/GamaLog.cs:23)
SimulationManager:TryBootstrapRuntimePlayer () (at C:/Users/flole/SIMPLE-Unity-Plugin/Runtime/Simulation/SimulationManager.cs:5589)
SimulationManager:FixedUpdate () (at C:/Users/flole/SIMPLE-Unity-Plugin/Runtime/Simulation/SimulationManager.cs:561)

[GAMA][CONNECTION][MESSAGE] type=ping length=15
UnityEngine.Debug:Log (object)
GamaLog:Dev (string) (at C:/Users/flole/SIMPLE-Unity-Plugin/Runtime/Utils/GamaLog.cs:23)
WebSocketConnector:LogReceivedMessage (string) (at C:/Users/flole/SIMPLE-Unity-Plugin/Runtime/Connection/WebSocketConnector.cs:193)
WebSocketConnector:<Start>b__14_1 (byte[]) (at C:/Users/flole/SIMPLE-Unity-Plugin/Runtime/Connection/WebSocketConnector.cs:75)
NativeWebSocket.WebSocket:DispatchMessageQueue () (at C:/Users/flole/SIMPLE-Unity-Plugin/Runtime/ThirdParty/NativeWebSocket/WebSocket/WebSocket.cs:637)
WebSocketConnector:Update () (at C:/Users/flole/SIMPLE-Unity-Plugin/Runtime/Connection/WebSocketConnector.cs:136)

[GAMA][CONNECTION][WARN] socket not open; skipping send state=Closing
UnityEngine.Debug:LogWarning (object)
GamaLog:DevWarning (string) (at C:/Users/flole/SIMPLE-Unity-Plugin/Runtime/Utils/GamaLog.cs:36)
WebSocketConnector/<SendMessageToServerAsync>d__23:MoveNext () (at C:/Users/flole/SIMPLE-Unity-Plugin/Runtime/Connection/WebSocketConnector.cs:156)
System.Runtime.CompilerServices.AsyncTaskMethodBuilder:Start<WebSocketConnector/<SendMessageToServerAsync>d__23> (WebSocketConnector/<SendMessageToServerAsync>d__23&)
WebSocketConnector:SendMessageToServerAsync (string)
WebSocketConnector/<SendMessageToServer>d__22:MoveNext () (at C:/Users/flole/SIMPLE-Unity-Plugin/Runtime/Connection/WebSocketConnector.cs:144)
System.Runtime.CompilerServices.AsyncVoidMethodBuilder:Start<WebSocketConnector/<SendMessageToServer>d__22> (WebSocketConnector/<SendMessageToServer>d__22&)
WebSocketConnector:SendMessageToServer (string)
ConnectionManager:ManageMessage (string) (at C:/Users/flole/SIMPLE-Unity-Plugin/Runtime/Connection/ConnectionManager.cs:113)
WebSocketConnector:<Start>b__14_1 (byte[]) (at C:/Users/flole/SIMPLE-Unity-Plugin/Runtime/Connection/WebSocketConnector.cs:76)
NativeWebSocket.WebSocket:DispatchMessageQueue () (at C:/Users/flole/SIMPLE-Unity-Plugin/Runtime/ThirdParty/NativeWebSocket/WebSocket/WebSocket.cs:637)
WebSocketConnector:Update () (at C:/Users/flole/SIMPLE-Unity-Plugin/Runtime/Connection/WebSocketConnector.cs:136)

[GAMA][CONNECTION][CLOSE] code=Normal
UnityEngine.Debug:Log (object)
GamaLog:Dev (string) (at C:/Users/flole/SIMPLE-Unity-Plugin/Runtime/Utils/GamaLog.cs:23)
WebSocketConnector:<Start>b__14_3 (NativeWebSocket.WebSocketCloseCode) (at C:/Users/flole/SIMPLE-Unity-Plugin/Runtime/Connection/WebSocketConnector.cs:88)
NativeWebSocket.WebSocket/<Receive>d__36:MoveNext () (at C:/Users/flole/SIMPLE-Unity-Plugin/Runtime/ThirdParty/NativeWebSocket/WebSocket/WebSocket.cs:700)
System.Runtime.CompilerServices.AsyncMethodBuilderCore/MoveNextRunner:Run ()
WaitForUpdate/MainThreadAwaiter:Complete () (at C:/Users/flole/SIMPLE-Unity-Plugin/Runtime/ThirdParty/NativeWebSocket/WebSocket/WebSocket.cs:66)
WaitForUpdate/<CoroutineWrapper>d__4:MoveNext () (at C:/Users/flole/SIMPLE-Unity-Plugin/Runtime/ThirdParty/NativeWebSocket/WebSocket/WebSocket.cs:78)
UnityEngine.SetupCoroutine:InvokeMoveNext (System.Collections.IEnumerator,intptr)

[GAMA] Disconnected from simple.webplatform.
UnityEngine.Debug:Log (object)
GamaLog:Info (string) (at C:/Users/flole/SIMPLE-Unity-Plugin/Runtime/Utils/GamaLog.cs:16)
SimulationManager:HandleConnectionStateChanged (ConnectionState) (at C:/Users/flole/SIMPLE-Unity-Plugin/Runtime/Simulation/SimulationManager.cs:4809)
ConnectionManager:UpdateConnectionState (ConnectionState) (at C:/Users/flole/SIMPLE-Unity-Plugin/Runtime/Connection/ConnectionManager.cs:83)
ConnectionManager:HandleConnectionClosed () (at C:/Users/flole/SIMPLE-Unity-Plugin/Runtime/Connection/ConnectionManager.cs:394)
WebSocketConnector:<Start>b__14_3 (NativeWebSocket.WebSocketCloseCode) (at C:/Users/flole/SIMPLE-Unity-Plugin/Runtime/Connection/WebSocketConnector.cs:89)
NativeWebSocket.WebSocket/<Receive>d__36:MoveNext () (at C:/Users/flole/SIMPLE-Unity-Plugin/Runtime/ThirdParty/NativeWebSocket/WebSocket/WebSocket.cs:700)
System.Runtime.CompilerServices.AsyncMethodBuilderCore/MoveNextRunner:Run ()
WaitForUpdate/MainThreadAwaiter:Complete () (at C:/Users/flole/SIMPLE-Unity-Plugin/Runtime/ThirdParty/NativeWebSocket/WebSocket/WebSocket.cs:66)
WaitForUpdate/<CoroutineWrapper>d__4:MoveNext () (at C:/Users/flole/SIMPLE-Unity-Plugin/Runtime/ThirdParty/NativeWebSocket/WebSocket/WebSocket.cs:78)
UnityEngine.SetupCoroutine:InvokeMoveNext (System.Collections.IEnumerator,intptr)

Screenshots or videos

Image Image

errorLog.log

Tiens et voici un autre errorlog de la webplatform avec un experiment totalement différent et pourtant compatible, preuve que le problème ne vient pas de ce choix mais du package
errorLog.log

Workaround

No response

Reporter checklist

  • I checked that the issue happens with the latest version of the tested branch.
  • I included the Unity version.
  • I included the GAMA model or experiment name.
  • I included clear reproduction steps.
  • I included logs or screenshots if available.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions