Hey, i have a problem in making the second button. The first button from main menu to the game itself work perfectly and i can play the level. But when the character dies and the endgame menu is enabled [with timescale 0 of course, end game is freezing the time] Then its just nothing happened with button for back to main menu. I’d checked the pointer event on eventsystem and the it doesn’t “sees” clicking on this button. and theres no highlights after i pointing it. Somebody know how to fix this? On the bottom i put some code for better view.
using UnityEngine;
using System.Collections;
public class StartGame : MonoBehaviour {
public void ChangetoScene (int SceneToChangeTo) {
Application.LoadLevel(SceneToChangeTo);
}
}
[...]
function Death ()
{
// Set the death flag so this function won't be called again.
isDead = true;
// Turn off any remaining shooting effects.
playerShooting.DisableEffects ();
// Tell the animator that the player is dead.
animation["die"].wrapMode = WrapMode.ClampForever;
animation.Play("die");
// Set the audiosource to play the death clip and play it (this will stop the hurt sound from playing).
playerAudio.clip = deathClip;
playerAudio.Play ();
playerAudio.loop = false;
yield WaitForSeconds(1f);
// Turn off the movement and shooting scripts.
PlayerMovement.enabled = false;
playerShooting.enabled = false;
Time.timeScale = 0.0;
audiolistener.pause = true;
GameOverMenu.active = true;
}
Screenshot: