- Home /
UnitySerializer wait until deserialized
Hi all! I am using the Unity Serializer asset and am running into a small issue... I have when a base scene is launched, it loads the last level. This works fine, but I need to call a function after all the resources are deserialized. I know there are OnDeserialized() functions, but I can't seem to get them to call correctly... this is my script thus far.
function Start () {
LevelSerializer.LoadNow(levelData);
loadTextures(); //This function needs called after loaded
loadedScene = true;
}
As you can see, pretty straight forward... just can't seem to get it to yield. I have tried using yield LevelSerializer
but it does nothing at all!
Thanks!
Answer by xKroniK13x · Apr 12, 2013 at 10:00 PM
I did this... not sure if it's the best but it worked.
while(LevelSerializer.IsDeserializing){
yield; //Wait until serializer is done before moving on...
}
Your other choice would be to put loadTextures and loadedScene in an OnDeserialized() function in your script.
Oh and I've just seen it wasn't working for you :( Hmmm, it should be called on everything that was serialized - I guess if this object wasn't then your approach is probably the best bet :)
Not a problem, $$anonymous$$ike! Your asset has been extremely helpful to projects I've done.
Your answer
