Hi, How Hide Continue Button in MainMenu, before game saved
script for hide button 1
using UnityEngine; using System.Collections; using UnityEngine.UI;
public class StartWindow : GenericWindow {
public Button continueButton;
public override void Open ()
{
var canContinue = false;
continueButton.gameObject.SetActive (canContinue);
if (continueButton.gameObject.activeSelf) {
firstSelected = continueButton.gameObject;
}
base.Open ();
}
protected override void Awake ()
{
}
// Use this for initialization
void Start () {
Open ();
}
}
script for hide button 2
using UnityEngine; using System.Collections; using UnityEngine.EventSystems;
public class GenericWindow : MonoBehaviour {
public GameObject firstSelected;
protected EventSystem eventSystem{
get { return GameObject.Find ("EventSystem").GetComponent<EventSystem> (); }
}
public virtual void OnFocus(){
eventSystem.SetSelectedGameObject (firstSelected);
}
protected virtual void Display(bool value){
gameObject.SetActive (value);
}
public virtual void Open(){
Display (true);
OnFocus ();
}
public virtual void Close(){
Display (false);
}
protected virtual void Awake () {
Close ();
}
}
script for my checkpoint(trigger for save player position)
void OnTriggerEnter2D(Collider2D other) { if (other.gameObject.tag == "Player") { PlayerPrefs.SetInt("CheckPoint", 0); PlayerPrefs.SetFloat("x", transform.position.x); PlayerPrefs.SetFloat("y", transform.position.y); PlayerPrefs.SetFloat("z", transform.position.z); PlayerPrefs.SetInt ("Level", SceneManager.GetActiveScene ().buildIndex); PlayerPrefs.Save(); Debug.Log("0"); print("Game saved!"); }
}
}
please Help me! thank you
Your answer
Follow this Question
Related Questions
Hide (not delete) text after given time..? 1 Answer
FPS Sample Unity - Show Main Menu on start,FPS Samples Unity show Main Menu on start 1 Answer
How do I get my pause menu to not be in the way of the Main Menu. 1 Answer
How to hide/reset a Text object (without disabling) 2 Answers
How to show and hide a Button and don't affect the Animation on it. 0 Answers