Animate text on iphone

Hi to all

I want to animate a text on iphone screen when a certain event happens. For example when that event happens the text will display big in size and it will move to the right and will get smaler as moved to right. when reaches at the end it will dis appear.

Any Idea to do that

thanks in advance

unityboy

Use a Rect to set the location for the text and in the Update() function just change the x value.

The problem is that Unity does not allow you to just change the size of fonts at will so you have two options here:

  1. Do a search for topics I posted and find my font scaling script. What this does is it calculates the height of the rect you want to write in and then it loads a new, smaller font as the rect’s height gets smaller. The problem with this approach is that you need to load up to 20 fonts in your resources folder and manually set the size for each of them and then rename each one to reflect the file size in the name…

  2. Use an image that contains the text and then simply do a DrawTexture that matches the size of the rect. In the Update() function change the size of the Rect’s height and width as you increase the x value…

I’d recommend using GUIText, then you can move and scale it as you like, the same as with any object. The only thing you can’t do is rotate it. If you need that too, then use 3D text.

–Eric

3DText is also useful if you want to move the text to or from the camera. For example, in HyperBowl the Game Over text moves from behind the camera to a position in front of the camera.

Edit: I should add that since the camera is a perspective camera the text of course appears to shrink as it moves further away.

Yep…3D text is good because it’s, well, 3D. :slight_smile: Also if you want it to interact properly with other 3D objects instead of always appearing on top of everything, use this shader.

–Eric

Oh yeah, I should use that modified 3DText shader! I have some 3DText on a scoreboard that is probably showing through the animated score models flying above, if you look closely (One more item for version 1.1)

sorry I was away, I think I can use 3D text to do it and GUIText is also fine…

thanks guys for good ideas

thanks again

unityboy