Closed LudwikJaniuk closed 7 years ago
Additionally, for large enough areas, the saving process seems to never exit and I have to kill it, often resulting in an ADF called "unnamed" being saved, which doesn't want to relocalize. I would really appreciate some input in this issue.
Alright, after finding the C API function that gets called under the hood and reading its docs, I found out that
Since the Tango Service locks internally, other API calls (such as TangoService_getPoseAtTime()) will block while this method is running.
Indeed, I have other objects in my scene that use the Tango API in their Update() functions, and after writing code to disable them for the time of saving, Unity does not freeze anymore.
I just wish it would have been mentioned in the Tango docs about the Unity function I was using.
Your "AreaLearning" example uses a new thread when saving an area, in order not to freeze the UI and to be able to show progress updates (this is the code in question). However, I've noticed that even though a new thread is being used, the call to
AreaDescription.SaveCurrent()
still freezes the UI and stops Unity from executingUpdate
calls for example. When saving large areas, this takes considerable amounts of time.Why does
AreaDescription.SaveCurrent()
freeze the main thread even though it's being started from a new thread? And what can I do to provide updates to my users even through this process?For the record, I tested this by inserting
Debug.Log
calls in theUpdate
function, and observing the adb logs when pressing save. When I do something else that is time-consuming in the new thread (specificallyfor (int i = 0; i < 300000000; i++);
), the update loop is still being run and I get my print calls. For some reason though,AreaDescription.SaveCurrent()
freezes everything until it is done.