- Home /
Question by
keyboard3000 · Mar 13, 2013 at 03:18 AM ·
guifontstyleonmouseenter
Change Font Style OnMouseEnter
Hello, I have a menu and on this I have the name of the game, I would like when the mouse enters the box collider that the Font Would change. Thanks
Comment
Answer by amphoterik · Mar 13, 2013 at 04:45 AM
Create 2 GUISkins, one for each font. Then when the mouse enters the collider, change the skin to the secondary. When the mouse leaves, change it back.
//this goes up top where you declare your class variables.
private GUISkin currentSkin;
public GUISkin skin1;
public GUISkin skin12;
//put this where you detect mouse entering
currentSkin = skin2;
//put this where you detect mouse exiting
currentSkin = skin1;
//ONGUI function
void OnGUI(){
GUI.Skin = currentSkin;
}
The variables have to be declared. Let me edit my post to reflect that
Thank you, but do i still have to declare each variable or is the GUISkin doing that, It tell me that the GUISkin is an unexpected token
Can you post your code so I can see what you are doing?