Advertisement
Guest User

Untitled

a guest
Feb 28th, 2020
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.59 KB | None | 0 0
  1. using System;
  2. using System.IO;
  3. using UnityEngine;
  4. using UnityEngine.UI;
  5.  
  6. public class InteractableButton : MonoBehaviour
  7. {
  8. private const string saveFileName = "save.bxm";
  9. [SerializeField]
  10. private Button button;
  11.  
  12. private void Start()
  13. {
  14. button.interactable = true;
  15. try
  16. {
  17. FileStream file = new FileStream(Path.Combine(Application.streamingAssetsPath, saveFileName), FileMode.Open, FileAccess.Read);
  18. } catch (FileNotFoundException ex)
  19. {
  20. button.interactable = false;
  21. }
  22.  
  23. }
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement