Skip to content

Screenshot action putting image in wrong folder when in play mode #465

@Skeletoneyes

Description

@Skeletoneyes

Bug: The manage_scene screenshot action reports saving to Assets/Screenshots/filename.png but actually saves to the project root folder

Cause: In ScreenshotUtility.CaptureToAssetsFolder(), only the filename was passed to ScreenCapture.CaptureScreenshot():

  string captureName = Path.GetFileName(normalizedFullPath);  // "filename.png"
  ScreenCapture.CaptureScreenshot(captureName, size);         // Saves to project root

Fix: Pass the project-relative path instead of just the filename:

ScreenCapture.CaptureScreenshot(assetsRelativePath, size); // "Assets/Screenshots/filename.png"

File: MCPForUnity/Runtime/Helpers/ScreenshotUtility.cs (lines 42-52)

Note: Only affects Play Mode screenshots. Edit Mode captures using CaptureFromCameraToAssetsFolder() were already working correctly since they use File.WriteAllBytes() with the full path.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinggood first issueGood for newcomers

    Type

    No fields configured for Bug.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions