Is this possible…
I have an animation that should start as soon as it can, then whilst it is running I want to load some data into an array and then start using it once it is ready. I thought the way to do this was using yield. However regardless of what I do the whole game stops whilst the initialising of the data takes place, this can take up to a several seconds. Is there a way around this?
So in more detail this is the setup
in one Update() function I play the animation - this works on its own fine.
Then in another script in Start() I call an init() function that yields whilst the data is loaded.
private var rbf : RBF;
function Start() {
rbf = new RBF(transform.gameObject, aniName, useCaching, useBlending, color1, color2 );
init();
}
function init() {
yield rbf.buildCache();
}
When I do this the entire game hangs until rbf.buildCache() returns.
Also, if I make the rbf.buildCache() function a void rather than returning a bool and then put another yield function inside it (as in the script help) the original animation starts playing correctly but the cache is never built.
Is there a way to set this up that will work?