SHARE
TWEET

Untitled

a guest Feb 28th, 2020 72 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top