How is this code loading an asset without even referencing it?

In this code, PlayCanvas Examples
the statue asset is somehow loaded without referring to its URL and filename.

In fact, all sample codes on github do not reference the assets at all and still show them.

If I were to replicate these codes in my projects, what additional lines do I have to make these codes work?

They’re all part of the example app which has a loader implemented behind the scene - you can find out the source code here: https://github.com/playcanvas/engine/tree/dev/examples/src/examples

for example see this one

it uses the asset loader from here to load the assets:

but few examples explicitly load assets, for example those in the loaders section, have a look at how to load and display glb file here for example:

1 Like