Get All Object Instances For RuntimeScene with Javascript


I want to pull all the instances for each object for a scene, into an array. Documentation says:

gdjs.RuntimeScene.prototype.getObjects = function(name){
    if ( !this._instances.containsKey(name) ) {
        console.log("RuntimeScene.getObjects: No instances called \""+name+"\"! Adding it.");
        this._instances.put(name, []);

    return this._instances.get(name);

So, I could get to nowhere with this method as _instances seems to be a private instance of HashTable object, thus I couldn’t access _instances so far from within the JS editor.

Is there a super simplistic way to do it, or should I go and extend the existing functionality?

Thanks in advance,


I figured it out. For future reference, in case it will be useful for somebody, here is how it goes:

if (runtimeScene.getTimeManager().isFirstFrame()) {

function getAllObjects(callback)
    var result = [];
    for (var i = 0, len = result.length; i < len; i++) {
        const myObject = runtimeScene.getObjects(result[i]);
            if (myObject.length !== 0) {

function callback(var1)

I have a similar problem like yours, but can we get the access instance of object without code?
I mean when when there are two instances of same object, say “Player” is object name and there are two “player” instances in the scene. In the events tab can i select them as → Player[0] and Player[1] , something like this…Is there a way??