This question already has an answer here:
For instance, when calling a web API with the WWW-class, I'd like a value returned or some feedback on when it's done and its status.
This question already has an answer here:
For instance, when calling a web API with the WWW-class, I'd like a value returned or some feedback on when it's done and its status.
Well then, me, let me show me a neat way of doing this!
Here we make an IEnumerator that takes in an Action (method in our case) as parameter and call it when our WWW is done:
And this is how we use it:
The parameter we send in is
(text)
which is a namelessly declared method. We call it "callback" in the IEnumerator but it can be called anything, what's important is that it calls the method we have declared in the parameters of where we call the method GetSomething.