Hi,
How can I change texture of an image element from URL through script?
Hi @Hassan_Amjad,
You can use the following method load a remote image file and create an asset to be used with the image element:
https://developer.playcanvas.com/en/api/pc.AssetRegistry.html#loadFromUrl
this.app.assets.loadFromUrl("../path/to/texture.jpg", "texture", function (err, asset) {
var texture = asset.resource;
myEntity.element.texture = texture;
});
1 Like