- Home /
OnMouseOver function
I am trying to get a price displayed next to the cursor when it is over a game object which can be purchased. Also would be handy if I could have a green colour if it can be bought and a red colour if there is not enough currency. My game is in C sharp language.
Answer by Meltdown · Mar 30, 2011 at 02:36 PM
If you have a GUI Label, you can set your price on that, and use Camera.ScreenToViewportPoint to set the position of your GUI Label to the position of your mouse.
To change the colour of your object, simply create two materials in your Assets pane, a red one and a green one, and set the objects material programatically based on if it can be bought or not.
Your answer

Follow this Question
Related Questions
Illuminating a 3D object's edges OnMouseOver (script in c#)? 1 Answer
make an object glow when mouse over 3 Answers
script not working :( 2 Answers
How to get AudioSource to play a Sound correctly? 1 Answer
Making object fall over after death 1 Answer