using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; public class WorkorderComponent : MonoBehaviour { static public WorkorderComponent instance; [HideInInspector] public bool filledOrder = false; public Transform weighRoot; // Start is called before the first frame update void Start() { for (int i = 0; i < weighRoot.childCount; i++) { if (weighRoot.gameObject.name.Contains("Toggle")) { weighRoot.GetComponent().onValueChanged.AddListener(OrderChanged); } else if (weighRoot.gameObject.name.Contains("InputField")) { weighRoot.GetComponent().onValueChanged.AddListener(OrderChanged); } } } public void OrderChanged(bool b) { filledOrder = true; } public void OrderChanged(string s) { filledOrder = true; } // Update is called once per frame void Update() { } }