Is there a better/shorter way to gather these scene objects and materials all at once in the case where I might have 50+ objects and mats? Maybe a loop and array or something but I'm not sure how to go about this.
// Scene Objects
const badge = await Promise.all([
Scene.root.findFirst('object0'),
Scene.root.findFirst('object1'),
Scene.root.findFirst('object2'),
Scene.root.findFirst('object3'),
Scene.root.findFirst('object4'),
])
// Objects Materials
const objectMaterial = await Promise.all([
Materials.findFirst('ObjectMat_0'),
Materials.findFirst('ObjectMat_1'),
Materials.findFirst('ObjectMat_2'),
Materials.findFirst('ObjectMat_3'),
Materials.findFirst('ObjectMat_4'),
])
You can use finds that support wildcards:
const badge = await Scene.root.findByPath('**/object*');
const objectMaterial = await Materials.findUsingPattern('ObjectMat_*');