realm-dotnet icon indicating copy to clipboard operation
realm-dotnet copied to clipboard

Investigate Unity initialization when domain reloading is turned off

Open nirinchev opened this issue 2 years ago • 2 comments

A user reported that when they turn off domain reloading in Project Settings->Editor->Enter Play Mode Settings, the second time they enter play mode, the SDK will hang when attempting to login a user. We should figure out what's causing this and guard against it. See this forum post for more details.

nirinchev avatar Mar 31 '22 20:03 nirinchev

Any updates or findings related to this yet? :) Our project is growing fast and domain reload times are already taxing our iteration speed. We'd love to turn them off.

moritz-mg avatar May 09 '22 21:05 moritz-mg

I'm sorry - we haven't had time to look at it yet. We've had to reshuffle some resources and a significant portion of the .NET team is helping other teams currently. This ticket is top of our backlog though, so as soon as we're done with time-sensitive feature work, we'll look at it.

nirinchev avatar May 09 '22 22:05 nirinchev

Happy New Year ;-)

This issue still hasn't been resolved and it really does make a huge difference when working on a Unity project (iteration speed).

It would be very much appreciated if you could provide an update on when/if this can be prioritised, thanks!

ebbe-brandstrup avatar Jan 03 '23 20:01 ebbe-brandstrup

I believe I have a fix for this - it appears the issue was that on domain unload/application exit, we detach the hooks into native to allow Unity to exit cleanly (otherwise native async operations may hang up the editor/game on exit). But because we were only attaching these hooks in static constructors, those weren't getting called when the app is restarted without a domain reload. I've followed the Unity docs on how to handle that case and it seems to be working correctly in the repro I cooked up. Once the CI build completes, I can try and give you the compiled package to test on your project.

nirinchev avatar Jan 04 '23 16:01 nirinchev

Here's a link for the updated package: https://drive.google.com/file/d/1D0tOOjVQ8xmNDTl5FjnGxgXzjB53Krne/view?usp=share_link. If you get a chance to test it out and confirm it resolves the issue, that would be amazing.

nirinchev avatar Jan 04 '23 23:01 nirinchev

@nirinchev that sounds great! Thank you!

I will be happy to test the updated package later today. I’ll reply again once I’ve been able to test.

ebbe-brandstrup avatar Jan 05 '23 06:01 ebbe-brandstrup

I've just installed the pre-release build and disabled domain reloading in my Unity project - and everything is good! It makes such a huge difference in the turn around time while developing. Thanks again @nirinchev!

ebbe-brandstrup avatar Jan 05 '23 15:01 ebbe-brandstrup