- Home /
Question by
Unax · Sep 04, 2014 at 12:38 PM ·
Hover Script problem
Hello! My name is Unax, and this is my first question, it's this... I have a Hover Script for title screens, but it have an error, how do I fix it? This is the script:
using System;
using System.Collections;
using UnityEngine;
[RequireComponent(typeof (AudioSource))]
[Serializable]
public class hoverScript : MonoBehaviour
{
public string levelToLoad;
public AudioClip soundhover;
public AudioClip beep;
public bool QuitButton;
public virtual void OnMouseEnter()
{
this.audio.PlayOneShot(this.soundhover);
this.renderer.material.color = Color.red;
}
public virtual void OnMouseExit()
{
this.renderer.material.color = Color.white;
}
public virtual IEnumerator OnMouseUp()
{
return (IEnumerator) new hoverScript.OnMouseUp(this).GetEnumerator();
}
public virtual void Main()
{
}
}
Comment
Couple of things:
Why didn't you post your error?
Why are you trying to instantiate a method? I assume this is where the error is, what are you trying to do?
public virtual IEnumerator On$$anonymous$$ouseUp() { return (IEnumerator) new hoverScript.On$$anonymous$$ouseUp(this).GetEnumerator(); }
Your answer
![](https://koobas.hobune.stream/wayback/20220613162301im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
beginner question- several errors 1 Answer
modifying scripts for mobile 0 Answers
Script is not working 2 Answers
what is wrong with my script 1 Answer
What to do when you can't make scripts 2 Answers