Text Information

is there a way to make a text box write different information according to the object I click on

Hi @Breno_Abner!

That’s possible. You need an element component and set the type to ‘text’. You can check the topic below about how to change the text at runtime.

So I can’t find where edit to have this result… I forked this one: PlayCanvas | HTML5 Game Engine
can you help me?

I just want to add the script to a object and automatically he wirites entity name

I can’t check that project on my mobile. The best approach depends on your project. Where do you want to show the name of the object? How many objects and how many text elements?

The easiest way is to use a raycast to detect the object and use the name of the result entity to show on the text element. The manual page below can help you with that.


If you want to use specific positions of an object, the example project below can be helpful.


I need something more automatic because my models are Towers of transmission and I need to automaticly name them when I activate the buttom

You can change the text based on the button the user clicks on or connect a text element to every button and enable/disable them based on the button the user clicks on.


My real problem is connect One buttom to interact with many objects without wiriting everytime their names

You can get the name of an entity with entity.name.

As long as you are not clear about your setup or logic, I can only share global information.

If your question is related to your other topic, you need to use a raycast and if the raycast has a result you can do something like element.text = result.entity.name.

I can create an example project for you as soon I’m home.

Below an example project.


I used the script from the manual page and modified it a bit.


thank you, but your project is offline. Error 404

Sorry, it was automatically set to private.

Please check again.

thank you very much!! Is there anything I can do to repay you?

Is that what you were looking for?

You already did! :upside_down_face: