Posted By

mediapoint on 04/16/14


Tagged

c# Create3DText


Versions (?)

Create3DText


 / Published in: C#
 

URL: www.mediapoint.gr

Create 3DText function

  1. public static GameObject Create3DText(string text)
  2. {
  3. GameObject txtObject = new GameObject();
  4. TextMesh txtMesh = txtObject.AddComponent(typeof(TextMesh)) as TextMesh;
  5. txtObject.AddComponent(typeof(MeshRenderer));
  6. txtMesh.text = text;
  7.  
  8. MeshRenderer meshRenderer = txtObject.GetComponent(typeof(MeshRenderer)) as MeshRenderer;
  9. meshRenderer.material = Resources.Load("Arial", typeof(Material)) as Material;
  10.  
  11. //Create a folder called "Resourses" in the assets
  12. Font font = Resources.Load("ARIAL", typeof(Font)) as Font;
  13.  
  14. txtMesh.font = font;
  15. return txtObject;
  16. }

Report this snippet  

You need to login to post a comment.