[SOLVED] findByTag Returning 0 Length Even Though Entities with Tag Exist

I have a findByTag function that is returning no entities even though I know there are entities in my scene with that tag assigned. What could be wrong here?

var assets = this.app.assets.findByTag("disable_on_mobile");
        var count = 0;
        console.log("Found "+assets.length+" with that tag");// returns 0 even though I DO have enabled objects with that tag in the scene???
        for (var i = 0; i < assets.length; i++)
            console.log("Disabled on mobile: "+assets[i].name);//the loop never runs because the length is 0

You are searching for assets, not entities here?

1 Like

Silly me. To search through scene entities it should be:

var assets = this.app.root.findByTag("disable_on_mobile");

Thanks! :slight_smile:

1 Like