How do I add an event listener for the WWW class?

I want an event dispatched whenever WWW is done loading in C#. I don't want to use yield, and I don't want to loop until it's done. What is the right way to dispatch these kind of events?

1 Answer

1

I guess you will have to use yield one way or another. You could write a wrapper for your www calls, that internally uses yield, but will trigger an event when finished. You can use the C# standard event system for that.

OK which are example classes in Unity which DO allow eventlisteners? I come from an AS3 background so I feel comfortable with events :)

You'd look up delegates (or events) in the c# reference on MSDN, e.g. http://msdn.microsoft.com/en-us/library/aa288459(VS.71).aspx