Scripting help

I am writing code for my weather that will enable and disable various particle effects according to the weather that is currently active and according to the time of day, my problem at the moment is in the pauseAll function, after it pauses everything how do I get it to return to the place where it was called? say after the “if (weatherChance <= 10) {” it calls that function how would I get it to return to that exact line where it was called after it is done pausing everything?

void springWeatherChances() {

        //chance to Change the weather at morning.
        if (currentTimeOfDay == .25) {
            weatherChance = Random.Range(0, 100);

            //40% chance that the weather will change.
            if (weatherChance >= 60) {
                weatherChance = Random.Range(0, 100);

                // 10% chance of default weather.
                if (weatherChance <= 10) {
                    pauseAll();
                    defaultCloudsDay.Play();
                    defaultWeatherActive = true;
                }
                // 10% chance of foggy weather.
                if (weatherChance < 10 || weatherChance >= 20) {
                    pauseAll();
                    defaultCloudsDay.Play();
                    foggyWeatherActive = true;
                }
            }
        }
    }

    void pauseAll() {
        defaultCloudsDay.Pause();
        defaultCloudsNight.Pause();

        foggyClouds.Pause();
        overcastClouds.Pause();
        darkClouds.Pause();
        clearClouds.Pause();
        ligthRainClouds.Pause();
        rainClouds.Pause();
        heavyRainClouds.Pause();
        ligthSnowClouds.Pause();
        snowClouds.Pause();
        heavySnowClouds.Pause();

        fog.Pause();
        ligthRain.Pause();
        rain.Pause();
        heavyRain.Pause();
        ligthSnow.Pause();
        snow.Pause();
        heavySnow.Pause();

        defaultWeatherActive = false;
        foggyWeatherActive = false;
        overcastWeatherActive = false;
        darkCloudyWeatherActive = false;
        clearWeatherActive = false;
        lightRainWeatherActive = false;
        rainWeatherActive = false;
        heavyRainWeatherActive = false;
        lightSnowWeatherActive = false;
        snowWeatherActive = false;
        heavySnowWeatherActive = false;
    }

After the pauseAll method completes it will automatically return and continue executing the code after where you called the method. So in your example, pauseAll will execute, then defaultCloudsDay.Play will execute.

really? I though I always had to call the next function, and I am not far enough in to test yet, thank you for the help

This is such a fundamental concept that I’m concerned we’re not talking about the same thing :). The whole point of calling a function is so you can go off and do some things, then return to continue where you left off. Statements get executed in order, a function call is just another statement. For example, if you have 3 functions called X, Y, and Z:

X();
Y();
Z();

It doesn’t really matter what the functions contain, X will be executed and do whatever, then Y will be executed, then Z will be executed - i.e. those 3 statements will be executed in order.

That makes sense, I don’t know what I was thinking earlier, I guess I tend to be over cautious when scripting and I also had a million thoughts racing through my head at the time, adding weather effects is not that easy for a beginner.