mdesign
October 12, 2022, 6:12pm
#1
I tweak that case a bit:
https://developer.playcanvas.com/en/tutorials/htmlcss-ui/
I wanted to put image underneath the button as inside the HTML file, but I don`t know the relative path to the asset folder and subfolders.
If I should use PlayCanvas editor TAGs instead of pure HTML solution to show image in that HTML UI then please tell me how to call those tags with hmtl/css/js? Is it a class or attribute or object name?
What if I would like to add to that HTML jQuery or Bootstrap js file there? Is it possible to put relative paths there?
Hi @mdesign ,
You can use the asset.getFileUrl() method for the image src attribute.
Here is a forum post that includes example code on how to do that:
Difficult to test without a project to fork. Try this. Same concept, do the replacement of the strings before adding the div to the page
ui3.prototype.initialize = function () {
// create STYLE element
var style = document.createElement('style');
// append to head
document.head.appendChild(style);
style.innerHTML = this.css.resource || '';
// Create the DIV
this.div = document.createElement('div');
this.div.classList.add('container');
this.div.innerHTML = this.html.resource || '';
this.div.…
1 Like
yaustar
October 13, 2022, 11:04am
#4
If you can post a reproducible, that will help people investigate further
mdesign
October 14, 2022, 2:54pm
#5
I have this error often during a previewing scene in your editor (launch button). I can`t post details now but I will do that in future.