wwwForm without IEnumerator and yield

Hello,

I am new to Unity3d. I dont really understand the flow when it comes to yield and IEnumerator. I have a simple script like this inside a class where I want to return a string:

public static string FunctionName()
{
//Inside here I want to create a wwwForm and get data from db
}

The problem here is that I can not use yield so I can wait for the www form to return so that the game do not freeze during this period. I have read that I need to use IEnumerator and yield (yield return wwwForm) but it seems so tricky to use since I just want to return a string value, and the function that calls the wwwForm-function needs to be IEnumerator.

Anyone have a solution to this? Thank you for taking you time!

You must use yield, and can’t return a string like that. Instead you can use a callback with the result.

–Eric

Thank you for your reply, could you please write an example function of how to use a callback?