- Home /
buttons not being able to be clicked?
I was about to publish my game, went to resize my joystick for scene 2, finished, went back to make sure it worked.... On the preloader scene(0) It wont let me click the button to go to the next scene if google services doesnt connect. (FailedStillPlay= my nonworking button) there is no debug log appearing either although there should be if the button is pressed. and also no errors in console. I went and tried to load scene 1 manually and im having the same issue with the "Start game button". ive tried removing scripts from game objects, reassigning the buttons... nothing, still cant click them. Its not all of them though my options button on scene 1 worked. so looks to be the buttons that use scenemanager? but its not even making it to the call for a new scene. Im royally confused. If anyone can take a look at this and help it would be much appreciated. thank you in advance.
EDIT: So after more looking... like a moron i stole my main menu when making the preloader. when i was doing touch-up like i stated earlier I went to make it a prefab and accidentally overwrote my main menu(scene 1) I've remedied the issues with scene 1 now, it works great and the menu is back to normal. however this doesn't really help as i still cant get past my preloader....? so just to clarify. My Only issues are with Scene 0, my preloader.
EDIT2: I added a debug.log to my update method. It still keeps logging that its happening even when i cant press my start game button. I should probably add that i cant press my exit button either, yet again doesn't show the debug message that its been pressed.
EDIT3: I successfully bypassed the button by sending my script there directly. it worked great.... but that doesn't really help as I still need to be able to click the button for the message and a pause, or else the user doesn't know they failed to connect to google and are playing offline. With this edit I'm officially out of ideas as to how to debug or fix this... Maybe start over but lol would rather not...
else if (seconds > 15 && !Failed) {
LoadingImage.SetActive (false);
LoadingText.SetActive (false);
FailedConnectButton.SetActive (true);
Failed = true;
Debug.Log ("Failed should be true, Failed="+Failed);
FailedStillPlay ();
}
Code for Preloader:
using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.SceneManagement;
public class PreloaderScript : MonoBehaviour {
public GameObject FailedConnectButton;
public GameObject LoadingImage;
public GameObject LoadingText;
bool Failed = false;
public int Scene;
GameObject GPServices;
float seconds = 0;
void Start () {
Scene = SceneManager.GetActiveScene().buildIndex;
GPServices = GameObject.Find ("GooglePlayServices");
LoadingImage.SetActive (true);
LoadingText.SetActive (true);
FailedConnectButton.SetActive (false);
}
void Update () {
if (GPServices.GetComponent<GPServices> ().ConnectedGooglePlayServices) {
Debug.Log ("Connected to google successfully, Failed should be false, Failed="+Failed);
SceneManager.LoadScene(1);
}
seconds += Time.deltaTime;
if (seconds <= 15) {
LoadingImage.transform.Rotate(0,0,-200*Time.deltaTime);
}
else if (seconds > 15 && !Failed) {
LoadingImage.SetActive (false);
LoadingText.SetActive (false);
FailedConnectButton.SetActive (true);
Failed = true;
Debug.Log ("Failed should be true, Failed="+Failed);
}
}
public void FailedStillPlay (){
Debug.Log ("connect button pressed");
SceneManager.LoadScene (1);
}
public void Exit(){
Debug.Log ("exit button pressed");
Application.Quit ();
}
}
Answer by Galatia410 · Apr 23, 2017 at 06:25 PM
lol since nobody answered this, I'm going to in case anyone has a similar issue and finds this. So after troubleshooting everything i could for almost 2 days... Its a simple problem. I forgot to put an "EventSystem" in so my buttons were not working, lol apparently they need one :)