- Home /
Audio script doesn't work
Hi everyone i have a script which for some reason doesn't work. Unity says that there is a parsing error could anyone help me out?
This is my script :
using System.Collections;
public class MenuObject: MonoBehaviour {
// Use this for initialization
void OnMouseEnter () {
renderer.material.color = Color.blue;
}
void OnMouseExit () {
renderer.material.color = Color.white;
}
public AudioClip click; // set this variable in the Inspector
void OnMouseDown () {
audio.PlayOneShot(Click);
Application.LoadLevel("LevelSelectScene");
}
Answer by robertbu · Jun 08, 2013 at 11:49 PM
Missing a closing bracket for the class
'click' should be lower case on line 19
Missing 'using UnityEngine' (may be past issue)
using UnityEngine; using System.Collections;
public class MenuObject: MonoBehaviour {
// Use this for initialization void OnMouseEnter () {
renderer.material.color = Color.blue; }
void OnMouseExit () {
renderer.material.color = Color.white; }
public AudioClip click; // set this variable in the Inspector
void OnMouseDown () { audio.PlayOneShot(click); Application.LoadLevel("LevelSelectScene"); } }
Note is far easier to get help if you 1) format you code when posting by selecting the code and using the 101/010 button, and 2) you past in the error text from the console window.
Your answer
Follow this Question
Related Questions
Randomly play audio 0 Answers
Clicking Game Object Scrpit 2 Answers
Using High Pass Filter with script 2 Answers
Sound on collision not working 1 Answer
Audio Problem 0 Answers