Link as Text element

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 :slight_smile:

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);

The problem is, it only adds URL on playcanvas existing URL, like in the picture

Grabbed one of the UI samples to give it a try, seems to be working fine. Check it here:

https://playcanvas.com/editor/scene/1042178

1 Like