Skip to content

setFullScreen not working in case of React hooks #74

@vinodkhandelwal

Description

@vinodkhandelwal

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>
);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions