I want to add text to the surface of a mesh. Is there a simple way to do that through GDScript?

9 days later

A simple solution is to use viewport.
1.Make the text by use label
2.Add a viewport to show the label.(Be the parent of it, dont be forget set the viewport size and enable vflip)
3.Add the material for mesh and enable"local to scene". Set albedo texture to the viewport texture.
4.Done!