- Home /
Please help! After build on Android UI buttons can't enable/disable script but works when using Unity remote.
I'm stucked while making an android game on Unity. Whenever I run my game in the GAME view it runs perfectly, the scene I'm working on is the choose controls scene where I have two buttons TILT CONTROL
using UnityEngine; using UnityEngine.SceneManagement; public class ControlTILT : MonoBehaviour { public PlayerMovementTILT PlayerTILT; public void ButtonTILT() { SceneManager.LoadScene(1); PlayerTILT.GetComponent<PlayerMovementTILT>().enabled = true; } }
and TOUCH CONTROL using UnityEngine; using UnityEngine.SceneManagement; public class ControlTOUCH : MonoBehaviour { public PlayerMovementTOUCH PlayerTOUCH; public void ButtonTOUCH() { SceneManager.LoadScene(1); PlayerTOUCH.enabled = true; } }
, the PlayerMovementTOUCH and PlayerMovementTILT scripts are attached to "Player" which exists in another scene, whenever I test them using Unity remote they always work but when I export and build the game on my phone the buttons take me to the scene (1) as i wanted but they do not enable the script PlayerMovementTOUCH or the PlayerMovementTILT... Please Help me out ASAP. Thanks. (: