Help with script for Main Menu?
So... I'm making a game! But what's a game without a main menu!?
What I'm trying to do with this code is the following...
Play music tracks on start [WORKS]
Animate a "Fade-from-Black" to the menu [WORKS]
Have the player press "any key" to start the game [NOT WORKING]
Animate a piece of text on the GUI upon "any key" being pressed [NOT WORKING]
Play a sound effect upon the game starting after "any key" being pressed. [NOT WORKING]
Play a Fade-to-Black animation... [NOT WORKING]
Load Next Scene [NOT WORKING]
My Problem (I believe,) is that my boolean isn't activating upon the keypress, which would trigger the boolean to start the game, which would trigger... everything else!
Could you guys check out my script and tell me where I went wrong? Thank you... I'm not getting any error messages and I've given up on trying to work this out on my own :(
var StartUpNoise : AudioSource;
var Fadein : Animation;
var MenuMusic : AudioSource;
var GameStart : boolean = (false);
var AnyKey : boolean = (false);
var Gunnoise : AudioSource;
var FadeOut : Animation;
var PointMove : Animation;
var Point : GameObject;
function awake() { FadeIn.PlayOneShot(); StartUpNoise.Play(); yield WaitForSeconds(5); MenuMusic.Play(); }
function update () {
if(Input.anyKey){
AnyKey = !AnyKey;
}
if(AnyKey){
GameStart = !GameStart;
}
if(GameStart){
Gunnoise.Play();
FadeOut.PlayOneShot();
Point.SetActive(true);
PointMove.PlayOneShot();
SceneManagement.SceneManager.LoadScene("Level001");
}
else {
AnyKey = false;
Point.SetActive(false);
}
}
Answer by Larsthedude · Nov 05, 2016 at 04:28 PM
Solved it! It was a variety of issues. Just some event coding. All good.