Last active
April 22, 2023 22:07
-
-
Save srcnalt/59925cb38d74de80528df4cb5e9c8c09 to your computer and use it in GitHub Desktop.
Useful Extension Methods
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// <summary> | |
/// Extension method to allow UnityWebRequest to be used with async/await. | |
/// </summary> | |
/// <param name="request">The UnityWebRequest to await.</param> | |
public async static Task SendRequestAsync(this UnityWebRequest request) | |
{ | |
UnityWebRequestAsyncOperation op = request.SendWebRequest(); | |
while(!op.isDone) await Task.Yield(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment