UnityAsync icon indicating copy to clipboard operation
UnityAsync copied to clipboard

Awaiting stops working in Editor after loading scene

Open cfoulston opened this issue 5 years ago • 6 comments

I believe this is because of the commit here: https://github.com/muckSponge/UnityAsync/commit/e01e2dc39084e4b5181dcef98344291ea3d5ddc3#diff-86c1eb8e1ae625825c97d335eaea9712

if(!Application.isEditor) // DontDestroyOnLoad can not be called in editor mode DontDestroyOnLoad(Instance);

When loading a new scene, the AsyncManager instance is destroyed preventing any Await calls to complete.

DontDestroyOnLoad does work in Editor. So not following the reasoning behind the change.

cfoulston avatar Mar 18 '20 01:03 cfoulston

Same here. UnityAsync fails heavily after loading a scene. Removing the IF makes it work fine. Mainly the frame counter becomes unusable.

drallcom3 avatar Apr 19 '20 13:04 drallcom3

Same! Resolved by commenting out the conditional

aylanonsense avatar Jul 28 '20 20:07 aylanonsense

+1, I wonder what the reason is behind that line.

tim-pp avatar Sep 19 '20 13:09 tim-pp

Pinging @muckSponge, just because some information would be useful. I am willing to put in a pull request to fix this but it would be good to understand why this code and the comment exists in the first place.

prodigga avatar Sep 26 '20 23:09 prodigga

Yeah go ahead with the pull request. If DontDestroyOnLoad works in the editor, that condition can be removed. I probably just didn't do thorough enough testing when I approved it.

muckSponge avatar Sep 30 '20 09:09 muckSponge

Actually, decided to fix this myself in cfd37ae62254fe35c893a9f73dcffe1284c453e2.

muckSponge avatar Sep 30 '20 11:09 muckSponge