- Home /
Question by
biohazard · Jul 21, 2011 at 02:01 PM ·
javascriptcoroutinefor-loopargument
changing a coroutine's argument at the coroutine's runtime?
I've got a coroutine that calculates rotation values using a for-loop. This coroutine got an integer as argument which is the speed of the coroutine.
is it possible to change a running coroutine's argument a runtime using a GUI.Button or something else?
like
var coroutineArgument : int = 0;
function Start()
{
StartCoroutine(MyAwesomeUberEpicCoroutine(coroutineArgument));
}
function OnGUI()
{
if(GUI.Button(Rect(Bla,Bla,Bla,Bla),"fast forward");
{
coroutineArgument = 5;
}
is this possible somehow?
any help is appreciated
thanks in advance,
bio
Comment
Best Answer
Answer by biohazard · Jul 21, 2011 at 02:37 PM
Nevermind, i solved the question saving the current counter in a variable stopping the coroutine and starting a new one with the old counter.
Your answer
Follow this Question
Related Questions
Keeping track of time? 4 Answers
What's wrong with this Loop? 2 Answers
Why can't i set my integer to -1? 2 Answers
Updating a TextMesh buggy? 1 Answer
[SOLVED]Does this loop actually end? 1 Answer