I want to have a callback function for when the UI needs to be disabled. Mainly because I want to let their own scripts have their own condition on when it becomes true. Hence, I made something like this:
IEnumerator HideUponActivation(Func<bool> activation) {
yield return new WaitUntil { ()=> { return activation.Invoke(); } };
}
This code won't work because I'm getting two errors:
- Cannot initialize type 'WaitUntil' with a collection initializer because it does not implement 'System.Collections.IEnumerable
- There is no argument given that corresponds to the required formal parameter 'predicate' of 'WaitUntil.WaitUntil(Func)'.
I want this script that contains HideUponActivation(Func) to manage the condition of which it needs to hide the UI. I don't want to make use of all the other gameobjects to grab a reference of this script nor do I want to call the Singleton instance of this script. Is it possible?