using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; public class LoadDirToggle : MonoBehaviour { public InputField LoadDirDateTextBox; public InputField LoadDirTimeTextBox; public Toggle Toggle; public GameObject DataTransfer; // Start is called before the first frame update void Start() { } public void OnToggleChanged() { // if loadDirToggle is on then turn off the input text boxs. LoadDirDateTextBox.interactable = Toggle.isOn; LoadDirTimeTextBox.interactable = Toggle.isOn; // if loadDirToggle is off set loaddirs as 0. if (!Toggle.isOn) { DataTransfer.GetComponent().LoadDirDate = "0"; DataTransfer.GetComponent().LoadDirTime = "0"; } } }