-
-
Notifications
You must be signed in to change notification settings - Fork 170
Description
Hi,
I am trying to use this library with react hooks. I am able to load the content and all events are also working. But somehow setFullscreen method is not working. With pre hook version of react this method is working. below is sample code that i am using. Please note that progress event is working properly here.
export default function App() {
let unityContent = new UnityContent(
"Build/Build.json",
"Build/UnityLoader.js"
);
const [progression, setProgression] = useState(0);
unityContent.on("progress", progressionVal => {
setProgression(progressionVal * 100);
});
const onFullScreen = () => {
unityContent.setFullscreen(true);
};
return (
<div> <Unity unityContent={unityContent} /> <button id="fullScreenButton" onClick={onFullScreen}></button> </div>
);