Can I post www data from an @MenuItem function?

I am currently trying this but it doesn’t seem to work. I get no errors and infact the function seems to not run at all if it contains a yield www; line of code in it.

Is this correct?

If so, how do I go about posting server data from inside the editor?

No, you can’t use WWW in an editor script because at edit-time you can’t use coroutines since the coroutine scheduler doesn’t run. Also If you use yield inside a function it becomes a coroutine which doesn’t work with menuitems.

Furthermore MenuItem is part of the UnityEditor namespace and can only be used in editor scripts. If you use it in a runtime script you’ll not be able to build your game!

You can use a ContextMenu attribute in a runtime class. The function needs to be a non static function, but you still can’t use WWW in this function since it’S invoked at edit-time.

Instead of WWW you can use WebRequest for example.