Yielding javascript from C#

Hi everyone,

I’m trying to use an api for facebook written with javascript in C#. The basic setup for this would be to create the “Plugins” folder and dump my javascript api in it. I later reference the correct (javascript) component in my (C#) component, this works fine for most functions however I did notice something odd about yielding.

Despite the method in the javascript api returning an IEnumerator type, I am not able to to call the method by using: “yield return component.methodName()”. Instead I have to surround my method name with “StartCoroutine()”. Is this the correct way to do things?

Secondly, the javascript api (internally) stores the result of StartCoroutine() in a typeless variable called complete. Later in the sample script (javascript) using this api yield is used as such: “yield ob.complete;” Where ob is a class in which the typeless complete variable is stored in. What would the C# equivalent of this be? I’ve tried “yield return ob.complete;” to no avail.

Not sure if I can directly help, but perhaps information on these pages can help:

http://unity3d.com/support/documentation/ScriptReference/index.Coroutines_26_Yield.html (be sure to change the language of the examples to/from JavaScript and C# for comparison)
http://unity3d.com/support/documentation/ScriptReference/index.Writing_Scripts_in_Csharp.html (part way down, section 4)