I want to add text on the surface of a mesh. Is there a simple way to do that through GDScript? The mesh could be a built in mesh object or an imported one (from blender for example).
If you mean text on a 3d mesh, here's how to do it:
Add a Sprite3D
Add a Viewport (plain) as a child of your Sprite3D
Add a Label as a child of your Viewport
Type the text you want to display into text, in the label
Attach a script to the Viewport
Put this inside:
tool
extends Viewport
func _process(_delta):
size = $Label.rect_size
(Sorry about this code, it's not all fitting into one code, so just type it out)
If you want to increase the size, you have to follow these steps:
Hopefully this works for you, if it doesn't tell me, and I will try fixing it!