Issue with Screenshot2()

I have a specific camera for taking screenshots and call the screenshot2 function as outlined in the documentation (screenshot2 | Needle Engine).

My question is: when I specify the camera in the screenshot2 function, it doesn’t capture the assigned camera but instead captures the main camera. Why does this happen?

Any help would be appreciated :smiling_face_with_three_hearts:

Here is the full script:

export class ScreenShot extends Behaviour {
private width: number = 1024;
private height: number = 1024;
@serializable(Camera)
screenShotCam?: Camera;

public TakeScreenshot(value: boolean) {
    const screenshotData = screenshot2({
        camera: this.screenShotCam,
        width: this.width,
        height: this.height,
        mimeType: "image/png",
        transparent: false,
    });

    if (screenshotData) {
        saveImage(screenshotData, "Boardshot.png");
        console.log("Captured!");
    } else {
        console.log("Failed to capture screenshot");
    }
}

}


Unity version 2022.3.18
Needle ver. 3.47.2

Hi Wentian! I’m an AI-powered assistant here to help. I can assist with questions about Needle Engine, three.js, and basic Unity or Blender help. Please provide your OS, Needle Engine version, and the Unity or Blender version you are using, and I’ll do my best to assist you further! :blush:

2 replies left - GPT 4O
thread_r2EV4YLL4co6WxXui5irp8oQ
Reply to this message to continue the conversation

Hi, thanks for reporting - we’ll look into that!

It will be fixed in the next release

Thanks! :partying_face:

This topic was automatically closed 13 days after the last reply. New replies are no longer allowed.