- Home /
Question by
EnderSeldon · Feb 15, 2014 at 11:55 AM ·
buttontriggermouseover
I want to target button with the camera and, after loading bar, activate button
I'm working on Oculus Rift demo and I want to use the camera looking to push the buttons. I know that can use mouseover to this, but I want the user needs to look the button during a few seconds (loading bar) and only if the loading bar ends to load, the button is pushed. If the user make mouseOut the loading bar is cancelled and the button isn't activate.
Best regards!
Comment
Answer by erick_weil · Feb 15, 2014 at 12:35 PM
//if I uderstanded what you want, put this in your buttom:
function Start () {
renderer.material.color = Color.black;
}
function OnMouseOver () {
delay += Time.deltaTime;
if(delay >=2)
{
renderer.material.color = Color.green;
// buttom active
}
else
{
renderer.material.color.g = delay/2;
// loading bar
}
}
function OnMouseExit () {
delay = 0;
renderer.material.color.g = 0.1;
}
Your answer
![](https://koobas.hobune.stream/wayback/20220613133559im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
image click quiz button problem 0 Answers
Select monobehaviour function from inspector 1 Answer
Trigger Sound more than Once 0 Answers
OnMouseOver UI Button c# 2 Answers
Triggering platform animation on colliding with Button 0 Answers