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.

Home Page:https://react-unity-webgl.dev

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

All useState hooks block work of setFullScreen.

sanscrid6 opened this issue · comments

commented

I added useState hook to my project and setFullScreen function stopped work. It just dont wont to set full screen.

I added this and fullscreen crushed

useEffect(function () {
unityContext.on("progress", function (progression) {
console.log(progression);
setProgress(progression);
}
);
}, []);

You're probably recreating the UnityContext object somewhere. Could you try creating the UnityContext inside of a UseEffect hook as an ComponentDidMount effect, or outside of the competent at all? Let me know if this helps.

commented

I just use browser fullscreen api instead of unity context setFullscreen function and it works.

Could you provide an example of what you did? Thanks

This issue is stale because it has been open for 30 days with no activity.

This issue was closed because it has been inactive for 14 days since being marked as stale.