Skip to main content

<pc-asset>

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

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

Attributes

AttributeTypeDefaultDescription
idString-Unique identifier used by other tags to reference this asset
lazyFlag-Whether to defer loading until first referenced or explicitly requested
srcString-Path to the asset file
typeEnuminferredAsset type: "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.