خرید بک لینک

Vote count: 0

Is there any way to run a function and get the retu value as a parameter for a function? Let me explain: I have a ton of functions lying around in my code which are just there for waiting a certain amount of seconds before something takes place. Since I only use them in one circumstance, I wanted to put them inside of my method that uses them somehow. (I'm using Unity3D.) Example:

public void SayHiAfterSeconds(float seconds) {
    StartCoroutine(sayHiAfterSeconds(seconds));
}
IEnumerator sayHiCoroutine(float seconds) {
    yield retu new WaitForSeconds(seconds);
    print("Hi.");
}

I want to put the sayHiCoroutine function inside of SayHiAfterSeconds. Something like:

public void SayHiAfterSeconds(float seconds) {
    StartCoroutine(IEnumerator() {
        yield retu new WaitForSeconds(seconds);
        print("Hi.");
    });
}

Is that possible? Thanks.

asked 2 mins ago

1 Answer

Vote count: 0

Short Answer: NO.

You can't put couroutine function in another function.

answered 19 secs ago

برچسب: نویسنده: استخدام کار تاريخ: يکشنبه 23 خرداد 1395 ساعت: 20:57

صفحه بندی