When the user clicks on the text element, I need to open up a new website
The problem is I can’t do this with HTML/CSS elements, It has to be text from PlayCanvas
Is there any way to do that?
I tried this code, but it’s not working
When the user clicks on the text element, I need to open up a new website
The problem is I can’t do this with HTML/CSS elements, It has to be text from PlayCanvas
Is there any way to do that?
I tried this code, but it’s not working
Hi @Dava,
Your code is correct, you just need to add it as a response to a click or touch handler. On a script that is attached to your element entity, and make sure you have Use Input enabled in the element component:
this.entity.element.on('mouseup', function(){
var win = window.open('https://www.playcanvas.com', '_blank');
win.focus();
}, this);
Grabbed one of the UI samples to give it a try, seems to be working fine. Check it here: