- Home /
make an object glow when mouse over
i have import an 3d object into the scene. and i want it has a bit glow or lighter when mouse over. how can i suppose to do it.
i check some of the similar answers but related to GUI what is GUI ?
thank for answering me
Answer by PetterDK · Apr 05, 2012 at 10:17 AM
GUI is an abbreviation of Graphical User Interface. The reason that other answers that you have found are related to GUI is that your question has direct relevance to GUI elements (in your case a button-like function).
What you are looking for is the function OnMouseOver()
. Documentation can be found here. It explains how to use it, you just have to use code that accomplishes the effect that you want to have when the mouse is over the gameObject.
thanks for your answer and i can do the mouseover effect by using "void On$$anonymous$$ouseEnter() { renderer.material.color = Color.red;"
but i don't want it become red i want an outline so i find out that ToonShading.unityPackage can create a white outline of an object is there any way to use Toon by script?
PetterD$$anonymous$$ thank you for answering my questions so briefly.
Answer by PetterDK · Apr 05, 2012 at 01:08 PM
My link was only for documentation so that you can see how it works. You will of course have to replace "`renderer.material.color = Color.red;`" with the effect that you want to have happen.
Unfortunately I can't help you with how to turn a shader on/off like that, but off the top of my head you might have to use a replacement shader. You can find documentation on that here: http://unity3d.com/support/documentation/Components/SL-ShaderReplacement.html.
No problem, just remember to upvote answers that you like and mark an answer as accepted..
Answer by papamck · Apr 05, 2012 at 12:38 PM
thanks for your answer and i can do the mouseover effect by using "void OnMouseEnter() { renderer.material.color = Color.red;"
but i don't want it become red i want an outline so i find out that ToonShading.unityPackage can create a white outline of an object is there any way to use Toon by script?
PetterDK thank you for answering my questions so briefly.
And please, do not write comments as answers.. You have already posted that exact same message as a comment.
Your answer
Follow this Question
Related Questions
detect mouseover with grid buttons? 1 Answer
MouseOver Clarification Please 2 Answers
Change GUI on mouse over 1 Answer
How to implement glow when moused over? 1 Answer
Getting mouse over GUI event 0 Answers