- Home /
How to wait click on button in my MessageBox analogue?
Hi!
I'm trying to implement my own analogue of .NET MessageBox but I have a problem. My method ShowDialog() returns variable with DialogResult type:
How to wait for the button to be pressed in MessageBox before returning DialogResult? I alredy tried to use coroutines, but it isn't work because it runs waiting methods parallel with other methods. implementation of MessageBox.ShowDialog():
P.S. I do not want to pass a delegate as a parameter to ShowDialog().
P.S.S. In C# I can loop this method, but in Unity it doesn't work: Application.Current.Dispatcher.Invoke(DispatcherPriority.Background, new Action(delegate { }));
Answer by Ziya · Jul 29, 2017 at 03:40 PM
Leave the button open.
Do calculations.
Close the button, when a user presses down on it.
Last step is done by adding a box collider (2d/3d) to a button.
I'm sorry, but I don't understand. What means "leave the button open"? What is the process of opening a button?