Hi all,
In an extension of this thread, I’ve decided that I want to create an array of objects procedurally on initialization. This would involve loading in assets by their path, for which I found pc.app.assets.getByUrl()
. A compact little function which according to the documentation should work like var asset = app.assets.getByUrl("../path/to/image.jpg");
.
Now, I’ve got my file structure similar to something like
/ (Root)
|–Art
|–Scripts
and so I expected something like pc.app.assets.getByUrl("../Art/textureFile.png");
to work. Cutting to the point, it apparently works instead like pc.app.assets.getByUrl("assets/files/Art/textureFile.png?id=[asset id]&branchId=[branch id]")
, which seems strange, given that the asset id is an 8 digit number that I have no way of knowing without spending time hunting for it, and the branch id can very well change each time I create a new branch.
Am I missing a simpler way to do this? The other way I can think of doing this is to cycle through the entire asset registry, looking for a particular snippet of “/Art/SpecificFolder/” and then pulling and filtering those files, which will undoubtedly end up messy.