External Publication
Visit Post

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

jMonkeyEngine Hub February 9, 2026
Source

Spatials and GameObject - of course they are different but in my game in SceneComposer the differences are:

  1. Spatials placed in a separate node “Meshes” and play the role of “Decoration”.
  2. GameObjects are also spatials meshes/primitives/nodes but placed in a node “Objects”. They are used only to transfer the UserData in the GameMapLoader to create using them (and also position and rotation) really game interactable objects in the game world.

Of course I need to have IDs especially for the second group. My opinion - using of Blender for unique names is a bad idea, because if I will need to change something in the game world - I will need to reload all the map from the Blender. JME3 will always be the last tool for map editing/adjusting and IDs should be attached directly in the SceneComposer window.

But I was wondered after the transfer from Tiled to SceneComposer in JME3. Two reasons of my surprising:

  1. SceneComposer make it possible to have same names for children (Blender prohibits).
  2. SceneComposer doesn’t attach some unique data ID to the objects in the Scene.

Maybe if I would make my game from the clear blank list - I would manually attach to every interesting object a unique readable name, like “chest_1”, “enemy_2”.

But when the core of the game exists already - I need to think very good - should fork the engine to attach the IDs to every placed object, correct the game core, or manually attach IDs to every object.

All my code is filled by using of method

getGameObjectById(int uniqueId);

I prefer to use IDs – not links to the objects to avoid possible memory leakages when the link to an object was saved in some event and one of the listeners didn’t release this event from its event-queue. I have a bad experience with saving links in previous games…

Discussion in the ATmosphere

Loading comments...