x


Yield in Boo functions won't work

I've been debugging a few scripts that work together great written in JavaScript, but when I attempt to use their Boo counter parts, I find that parts of them simply will not run. That is, the called functions will not respond, but there is no error in the log.

This seems to happen when I have a yield WaitForSeconds(someTime) in the function, i.e.:

def ApplyDamage():
    yield WaitForSeconds(someTime)

Basically, the script won't even touch ApplyDamage(). If I put a print statement inside the function, it gives me nothing in the console.

Anyone have any ideas? Thanks!

more ▼

asked Apr 18 '11 at 12:03 AM

Ves gravatar image

Ves
48 10 10 15

(comments are locked)
10|3000 characters needed characters left

1 answer: sort voted first

Most likely it's the same as c# - you'll need to use StartCoroutine(ApplyDamage()); to call the function, as js is the only language which does that implicitly

more ▼

answered Apr 18 '11 at 12:27 AM

Mike 3 gravatar image

Mike 3
30.5k 10 65 253

I am pretty certain it has something to do with this. I got it to work by importing System.Collections and setting the definition as an IEnumerator.

Apr 18 '11 at 03:57 AM Ves
(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x335
x70

asked: Apr 18 '11 at 12:03 AM

Seen: 804 times

Last Updated: Apr 18 '11 at 12:03 AM