Skip to main content

<pc-asset>

The <pc-asset> tag is used to define an asset.

note
  • It must be a direct child of <pc-app>.

Attributes

AttributeDescription
idThe ID of the asset. This is used by other tags (such as <pc-sky>) to reference this asset.
lazyValueless attribute. If present, the asset is not loaded until it is first referenced by the scene or explicitly requested via the Engine's Asset API.
srcThe path to the asset.
typeThe type of asset. If not specified, the type is inferred from the file extension. Can be: audio, binary, css, container, gsplat, html, json, script, shader, text, texture.

Example

<pc-app>
<!-- Script asset -->
<pc-asset src="assets/scripts/animate.mjs"></pc-asset>
<!-- GLB asset -->
<pc-asset src="assets/models/car.glb" id="car"></pc-asset>
</pc-app>

JavaScript Interface

You can programmatically create and manipulate <pc-asset> elements using the AssetElement API.