Finding Models and Materials from a glb in Script

I am writing a script that populates an entity’s renderer and materials at runtime from a JSON script. (Different variations of entities)

However, rather than having to specify separate mesh names and material names (which are often quite arbatory - Mesh.001 for example) Id like to just put the name of the GLB folder, then my script can access the glb folder and extract the relevant resources.

Any ideas of the best way to do this? Hopefully there is an easy method as finding materails etc manually within a folder sounds like it could become tricky especially if some entities have multiple materials etc.


EDIT: In order to be a bit more specific to get me going :slight_smile: How do I search for assets (of a certain type) within a specific folder inside my assets?

Hi @Grimmy,

You can’t do that, folders are an editor only thing and don’t exist as a concept in the engine.

You will need to come up with a different way of indexing your assets e.g. add a tag and then use findByTag().