How to Set 3D Text Dynamically

Hi All,

How to set 3D Text dynamically[Using java script] in unity 3D.If anybody know about this please reply.

Thanks
jayaprakash S

var tm : TextMesh = gameObject.GetComponent(TextMesh);
tm.text = “Some string”;

sadly you dont have access to all of the 3D Text properties; only text and font.

1 Like

Hi Mitch,

Great!!!Thank you so much.Its working perfectly.

Cheers

Hi All,

i have another doubt.How to destroy the particular prefab object after touch event[Touching the particular prefab object].If anybody know please reply.

Thanks in Advance,
jayaprakash S

It will depend on the control system you are using, but you can probably do this by adding an OnMouseDown function to your object’s script and destroying it from there:-

function OnMouseDown() {
   Destroy(gameObject);
}

Hi,

Thank you so much…Its working really very good…

Thanks

Hi All,

How to change 3d Text color dynamically in unity 3d.If anybody know,please share with me.

Thanks

This will change 3D Text to red for example:

renderer.material.color = Color.red;

Here is the script reference for other options:

Hi,

Thanks for your reply.Already i set 3D Text in my project.Then i placed 3 buttons and assigned the color name like Red,Green and Blue.
Then if i select RedButton 3D Text should be change red color.Similarly if i select GreenButton 3D Text should change green color.Please reply if u done this in previous.

Thanks

Hi All,

i solved that problem.Its working fine.

Thanks