Question by
VictorSomar · Jun 11, 2016 at 11:21 PM ·
waitforsecondsmethodcallargument
Resume code after wait specified time
public class BlaBlaBla : MonoBehaviour {
void LaLa(Collider other)
{
somecode
StartCoroutine(BleBle());
destroy object.other //execute this code after the wait
}
IEnumerator BleBle ()
{
yield return new WaitForSeconds(xf);
}
}
In other words what I want to do is call that specific line on that method and keep going from there.
There is no way that I know that I can put that line of "somecode" after the yield return new line as it uses an inside argument, the "other". Nor can I put the IEnumerator inside the void... I have tried that.
Comment
public class BlaBlaBla : $$anonymous$$onoBehaviour {
void LaLa(Collider other)
{
somecode
Destroy(other.gameobject,xf);
}
}
Be a bit more specific, what do you mean by that specific line on that method?
Answer by NoseKills · Jun 12, 2016 at 02:23 PM
void LaLa(Collider other)
{
somecode
StartCoroutine(BleBle(other));
}
IEnumerator BleBle (Collider other))
{
yield return new WaitForSeconds(xf);
Destroy(other);
}
Your answer
Follow this Question
Related Questions
Unity Cloud Build call Pre-Export Method with args 1 Answer
Waitforseconds doesn't work outside Start(). 0 Answers
call any method 1 Answer
IENumerator does not work 0 Answers
WaitForSeconds clarification 1 Answer