Skip to content

Calling jslib function from async C# class method #413

Discussion options

You must be logged in to vote

I'm no expert with how Unity and C# async/await play together, but I think the issue is caused by the async function being called on another thread; unable to call the static function, resulting in the execution silently failing/hanging.

I fixed the issue by using the third-party package UniTask so that async functions are executed on the player loop, replacing all Tasks in my code with UniTask.

I would still be interested in knowing the reasons why the original approach did not work, and I think it could be helpful to document this use case.

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
0 replies
Answer selected by matt-d-rat
Comment options

You must be logged in to vote
2 replies
@matt-d-rat
Comment options

@matt-d-rat
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants