Skip to content
Tags

Mesh Text and scripting behavior

August 30, 2010


Fisrt time we must create Empty game object.
Also this time we not use GUI Text game object.
(GUI TEXT is different  method that may just screen display can be use)
 


 
  And then, Actually Empty GameObject must necessary to Mesh renderer component and Text mesh component for viewpoort rendering. 
 
 
Ok. two component(Text mesh , Mesh renderer) adding your Empty Game Object.





   
You can find to ‘font material’ at below Fonts folder drop down ‘Courier font’.
That must need to rendering in your view screen for text mesh.
   
   
 
 

You can be able to font resize in inspector window and then have to resize font texture that is very important point.
Perhaps you should be resize to W4096 size or higher.because font mesh texture default size is W1024 or W2048 that is you see to low viewport texture quality.
(Ok. Next time that process when I will introduce about how to setting up about method of maintain quality. )
 
 

And then you must set to make collider using Box collider inside physics for picking to game object.

 


You have to making unity script for behavior calss.

 

 
function OnMouseEnter ()
{
renderer.material.color = Color.red; //color is attribute part and Color is class. 
 
}
 
function OnMouseExit ()
{
renderer.material.color = Color.white; //color is attribute part and Color is class.
}
 
See above a like writing script using java via unity script editor  or VS 2010.



 
And last you have to add this script component to two text game object that finish setting for this goal.

 

 

Color class REF.  
 
Components (r,g,b) define a color in RGB color space. Alpha component (a) defines transparency – alpha of one is completely opaque, alpha of zero is completely transparent.
Variables
<><><><> <><><><><><><><>

<><><><> 



r


Red component of the color.


g


Green component of the color.


b


Blue component of the color.


a


Alpha component of the color.


grayscale


The grayscale value of the color (Read Only)


this [int index]


Access the r, g, b,a components using [0], [1], [2], [3] respectively.
Constructors
<><><><> <><><><><><><><>

<><><><> 



Color


Constructs a new Color with given r,g,b,a components.
Functions
<><><><> <><><><><><><><>

<><><><> 



ToString


Returns a nicely formatted string of this color.
Class Variables
<><><><> <><><><><><><><>

<><><><> 



red


Solid red. RGBA is (1, 0, 0, 1).


green


Solid green. RGBA is (0, 1, 0, 1).


blue


Solid blue. RGBA is (0, 0, 1, 1).


white


Solid white. RGBA is (1, 1, 1, 1).


black


Solid black. RGBA is (0, 0, 0, 1).


yellow


Yellow. RGBA is weird (1, 235/255, 4/255, 1), but the color is nice to look at!


cyan


Cyan. RGBA is (0, 1, 1, 1).


magenta


Magenta. RGBA is (1, 0, 1, 1).


gray


Gray. RGBA is (0.5, 0.5, 0.5, 1).


grey


English spelling for gray. RGBA is the same (0.5, 0.5, 0.5, 1).


clear


Completely transparent. RGBA is (0, 0, 0, 0).
Class Functions
<><><><> <><><><><><><><>

<><><><> 



operator +


Adds two colors together. Each component is added separately.


operator –


Subtracts color b from color a. Each component is subtracted separately.


operator *


Multiplies two colors together. Each component is multiplied separately.


operator /


Divides color a by the float b. Each color component is scaled separately.


Lerp


Interpolates between colors a and b by t.


operator Vector4


Colors can be implicitly converted to and from Vector4.


operator Color


Colors can be implicitly converted to and from Vector4.

Game Developer Leegoon copyright all right reserved since 2010.

Advertisements

From → Unity3D Study

Leave a Comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: