Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add EndOfFrame implementation using UnityEngine.Awaitable #496

Merged
merged 2 commits into from
Sep 14, 2023

Conversation

hadashiA
Copy link
Contributor

@hadashiA hadashiA commented Sep 7, 2023

Currently, MonoBehaviour is required to implement EndOfFrame, but Awaitable.EndOfFrameAsync is available from Unity 2023.1.

@hadashiA hadashiA marked this pull request as ready for review September 7, 2023 08:39
@@ -75,6 +75,12 @@ public static UniTask NextFrame(PlayerLoopTiming timing, CancellationToken cance
return new UniTask(NextFramePromise.Create(timing, cancellationToken, out var token), token);
}

#if UNITY_2023_1_OR_NEWER
public static async UniTask WaitForEndOfFrame(CancellationToken cancellationToken = default)
Copy link
Contributor Author

@hadashiA hadashiA Sep 7, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have done a easy implementation that uses async.
Should I consider adding Awaitable.ToUniTask()?

📝 But Awaitable is has so few features that converting it to IUniTaskSource could be inefficient.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK to use async.

@neuecc
Copy link
Member

neuecc commented Sep 8, 2023

EndOfFrame thing is mentioned a lot in the ReadMe, I'd like to see an addendum in the ReadMe about the behavior in Unity 2023.1 and later.

@hadashiA
Copy link
Contributor Author

hadashiA commented Sep 8, 2023

I've updated the README !

@neuecc
Copy link
Member

neuecc commented Sep 14, 2023

thanks!

@hadashiA hadashiA merged commit acc7155 into master Sep 14, 2023
5 checks passed
@hadashiA hadashiA deleted the hadashiA/awaitable branch September 14, 2023 07:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants