External Publication
Visit Post

Does JME3 attach a unique ID to every element of a scene?

jMonkeyEngine Hub February 9, 2026
Source
Hmm, I want to add that Tiled is not a software for a specific game/engine - it is a software for universal games on different engines/frameworks. I understand the idea of Java. It would be excellent, if there will be fully integration of the SceneComposer and Java objects inside the scene in pre-compile time (development phase). I mean - if I can right click on the element in the sceneComposer and press something like - “copy java-object unique link” and after that add this data (string or int) in my scripts or data. And after the compilation this unique links stay valid and I can find elements on the scene using these links. But I think it is impossible, doesn’t it? Give me please an advice: How would you solve same problem? My game map development pipeline seems to be so: I create an empty scene. I create a node “Meshes”. I create a 3D world by adding/linking meshes (created in Blender) in this node. I create a node “Objects”. I add in this node meshes/primitives and attach to these objects UserData (for enemies - viewAngle (float), for chests - isOpened(boolean) and so on). Some objects must be affected by scripts - the enemy must teleport behind the player if the chest is opened. At this moment (in 2D) the script searches for the chest and the enemy using the unique IDs, which are really unique integers for the whole Scene and visible in the map editor. I’m sure two objects will not receive same IDs. Never. In JME3 I need manually add the user data field “ID” and manually fill this field with the numerical value. It seems I need validate the map by the map-launch - are there overlapping IDs and crash the JVM and notify the developer – Logger.criticalError("You have duplicating ID's on the map for objects: " + conflictingSpatial1.getClass().getSimpleName() + " and " + conflictingSpatial2.getClass().getSimpleName()); Would you also do so? Or there are better recipes?

Discussion in the ATmosphere

Loading comments...