When I try import { CreateScreenshotAsync } from "@babylonjs/core/Misc/screenshotTools"; my code breaks. I am just using it like this:
const data = await CreateScreenshotAsync( engine, scene.activeCamera as Camera, 150, );
This works fine when I import Tools, but stops working when I try the tree shaking way. Is there a way to fix this without having to import Tools from core?
CreateScreenshot, CreateScreenshotUsingRenderTarget , EncodeScreenshotCanvasData as well.
CreateScreenshotAsync is just an async wrapper.
Check the log which function is missing if it still doesn’t work. Maybe there are more side effects. You need to import all functions used in the screenshot process.
I also attempted import { ScreenshotTools } from "@babylonjs/core/Misc/screenshotTools"; alongside import "@babylonjs/core/Misc/tools"; which also doesn’t work.