jeffreylanters / react-unity-webgl

React Unity WebGL provides a modern solution for embedding Unity WebGL builds in your React Application while providing advanced APIs for two way communication and interaction between Unity and React.
https://react-unity-webgl.dev
Apache License 2.0
1.75k stars 162 forks source link

Fixed event return value not being returned (#40 regression) #455

Closed ZimM-LostPolygon closed 2 years ago

ZimM-LostPolygon commented 2 years ago

Somewhere during the v9.x refactor, a regression was introduced that made it not possible to return values from an event back to Unity. This PR fixes that and makes this feature work again.

Reference: https://github.com/jeffreylanters/react-unity-webgl/issues/40 https://github.com/jeffreylanters/react-unity-webgl/pull/41 https://github.com/jeffreylanters/react-unity-webgl/pull/42

P.S. I feel like "event" was a poor choice of word, it implies just firing and forgetting. However, it's really more like a bound function, and functions surely can return values.

ZimM-LostPolygon commented 2 years ago

Not sure what to do with that failed CodeQL check - seems like something completely unrelated to my changes?

jeffreylanters commented 2 years ago

Yes, it's unrelated. Not sure what causes it either. I'll be merging it anyway, thanks for your contribution! 🙌🏼

jeffreylanters commented 2 years ago

Also I see what you mean. The name event was chosen based on the existing browser APIs which also apply this naming scheme.