I am currently working on a game based on atoms. The game allows you to play around with all kinds of atoms from the Periodic Table. In order to reduce the art assets I want to create textures dynamically and slap it onto the atoms (spheres). I can do this easily in editor using a RenderTexture. However, when I try doing it in script (C#) the text simply doesn't show up in the RenderTexture. Here is my code:
I just need to figure out how to get the GUIText to render onto my target texture. I think there is something really silly that I am doing. Any help would be great!
Thank you very much!
asked Aug 09 '10 at 03:44 PM
Okay I think I figured it out, or rather found an alternative.
I used a 3DText (TextMesh) instead. I created a prefab with a Camera, Plane and 3DText. The Plane will hold the material you want to show up on the atom. The 3DText will go on top of this plane. The Camera is then set perpendicular to them and thus captures the 3dText over the plane onto a RenderTexture. At this point I have pretty much what I wanted. I doubt if this is the most efficient way to do it, but works pretty well for my game. Also, make sure you use the 3DText Shader instead of the default one. Its available here. Else your text will appear scrambled when you try to use custom font.
Here is the code I used in case any wants to try it out:
answered Aug 09 '10 at 07:13 PM