Closed rodcibils closed 6 years ago
Try with this procedure:
ObjectImporter
, when you call ImportModelAsync(...)
, in options
parameter you should leave reuseLoaded
to false
(default)OnModelmported
, so you get a reference to the imported object (see issue #24 ) and store it in a variable of your script (e.g. myLastLoadedObject)ImportingComplete
(e.g. create a method OnImportingComplete) so you know when the old loader is destroyed before loading a new objectDestroy(myLastLoadedObject)
, see above) and reset your flags and variablesImportModelAsync(...)
)I think this should work, I'll wait for your feedback.
Well, in first place, thank you very much for the fast answer, it's really awesome work with a free tool like this knowing that it's developer takes care about it. I implemented the procedure above with no issues, work as expected. I had already done some of the steps above like getting the reference of the imported object (and edit scale, position, etc.), and adding the new steps has no negative effects on that. so everything works fine at the moment. I'll report if there's a new issue on the road.
What is the procedure for unloading an already loaded model? Can I just delete it with unity or there is something else to do with the importer?
I want to prevent the parallel loading of several models, check if a model is already loaded and, if the user wants to load a new one, unload the older and load the newer.
Thanks for develop and share this excellent tool.