How can I run functions in succession, each waiting for the last to complete?

Hi everyone, is it possible to run functions in succession without them being inside of one another?

for example, let’s say I have four functions;

FadeIn();
ContinueButton();
FadeOut();

In this example, I’d like to have a GUI button in ContinueButton that waits for the player to press it before the camera fades out in the previous function. However, I’d like to do this without putting FadeOut inside of ContinueButton’s GUI.Button event, rather having it just allow the next function to run when the button is pressed. So far, when I run the program FadeOut will obviously just run at the same time.

If you are using C# take a look at coroutines. They allow you to run events in order. I use them for all my ordered processes and cut scenes.

Reading what you are trying to achieve perhaps you could do something fancy with Delegates (Action<>) passing pre-defined functions into coroutines.

Here are the docs on Action Delegates:

does

void Awake() { FadeIn(); ContinueButton(); FadeOut();}

work for you?