Skip to content

Possible to take a screenshot? #232

Discussion options

You must be logged in to vote

Hi, ScreenCapture.CaptureScreenshot is not available is WebGL. I will add support for taking screenshots in the near future. But for now, there is an easy solution for taking screenshots from your web application as following:

import React, { useEffect, useState } from "react";
import Unity, { UnityContext } from "react-unity-webgl";

const unityContext = new UnityContext({
  loaderUrl: "build/myunityapp.loader.js",
  dataUrl: "build/myunityapp.data",
  frameworkUrl: "build/myunityapp.framework.js",
  codeUrl: "build/myunityapp.wasm",
});

function App() {
  const [canvas, setCanvas] = useState(null);

  useEffect(function () {
    unityContext.on("canvas", setCanvas);
  }, []);

  function 

Replies: 1 comment 4 replies

Comment options

You must be logged in to vote
4 replies
@oulfik
Comment options

@jeffreylanters
Comment options

@jeffreylanters
Comment options

@jeffreylanters
Comment options

Answer selected by jeffreylanters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #231 on September 02, 2021 13:29.