OnMouseEnter is blinking
Hello ! Since the last 4 days, I'm working on a script highlighting . When my cursor is over a special object, I apply a special effect to it.
My problem is that I use the function OnMouseEnter and OnMouseExit to make it work but they are "blinking", the effect don't stop to appear and desappear.
Here's my code :
private Shader normal;
private Shader hover;
private Renderer renderer;
void Start()
{
renderer = GetComponent<Renderer>();
normal = Shader.Find ("Standard");
hover = Shader.Find ("FX/Gem");
}
void OnMouseEnter()
{
GetComponent<Renderer> ().material.shader = hover;
}
void OnMouseExit()
{
GetComponent<Renderer> ().material.shader = normal;
}
My last solution is to change my code to a Raycast system... But I prefer to ask you before to change.
(Sorry for my poor english..)
Answer by Tiji · Dec 06, 2015 at 09:35 PM
Ok, i've found one new information. The problem come from my network system. When it's not launched, highlight script work perfectly. So anyone has solution ? Maybe an idea ?
Your answer
Follow this Question
Related Questions
OnMouseEnter and OnMouseExit collide (I guess) and make an animation loop for no reason. 0 Answers
Color transtition not rendering 1 Answer
OnMouseEnter OnMouseExit, and Event Triggers Not Working? 1 Answer
OnMouseEnter causes an object to disappear for some reason 1 Answer
Logic problem looping & timing 2 Answers