NoaScreenshotCallbacks
Configure events related to the screenshot feature.
By passing a class that inherits NoaScreenshotCallbacks to NoaController, you can customize events related to the screenshot feature.
Overridable Members
Methods
| Name | Description |
|---|---|
| OnBeforePrepareScreenshot() | Executed before controlling the NOA Debugger UI display according to the ScreenshotTarget described below. By changing ScreenshotTarget here, execute OnCaptureScreenshot with unnecessary NOA Debugger UI hidden. |
| OnCaptureScreenshot() | Executed immediately before NOA Debugger’s screenshot process. |
| OnAfterScreenshot() | Executed after the screenshot process. Executed even if NOA Debugger’s screenshot process was not executed. |
Properties
| Name | Description |
|---|---|
| IsAllowBaseScreenshot | Determines whether to execute NOA Debugger’s screenshot process. Default is true; if set to false, the screenshot process is not executed. |
| ScreenshotTarget | Specifies the NOA Debugger UI to preserve as visible during screenshot capture. Default is None, which captures with all NOA Debugger UI hidden. |
Related Types
INoaScreenshotCallbacks
The overridable methods and properties of NoaScreenshotCallbacks are defined in this interface.
If you want to consolidate multiple callback definitions in a custom class, or add callback functionality while inheriting an existing custom class, you can achieve this by using this interface instead of the NoaScreenshotCallbacks class.
NoaController.ScreenshotTarget
A [Flags] enum used by NoaScreenshotCallbacks properties to specify screenshot targets.
Capture with NOA Debugger UI not included in the targets hidden.
| Item | Description |
|---|---|
| None | Capture with all NOA Debugger UI hidden. Note: Because other flags take precedence, use None by itself. |
| LaunchButton | Include launch button in the capture targets. |
| FloatingWindows | Include floating windows in the capture targets. |
| UIElement | Include UI elements in the capture targets. |
| MainView | Include main view in the capture targets. |
| Overlays | Include overlays in the capture targets. |
| All | Include all NOA Debugger UI in the capture targets. |
Sample Code
#if NOA_DEBUGGER
using NoaDebugger;
using UnityEngine;
// Example of executing events before and after NOA Debugger’s screenshot process.
public class ExampleScreenshotManager : NoaScreenshotCallbacks
{
NoaController.ScreenshotTarget target;
public override NoaController.ScreenshotTarget ScreenshotTarget => target;
public override void OnBeforePrepareScreenshot()
{
// Example of changing whether to include NOA Debugger UI in the screenshot depending on the current scene.
if (ExampleSceneManager.Instance.CurrentScene == SceneType.Battle)
{
target = NoaController.ScreenshotTarget.UIElement | NoaController.ScreenshotTarget.Overlays;
}
else
{
target = NoaController.ScreenshotTarget.None;
}
}
public override void OnAfterScreenshot()
{
byte[] data = NoaController.GetCapturedScreenshot();
if (data != null)
{
// Example of saving the image data to a file.
string filePath = Application.persistentDataPath + "/screenshot.png";
System.IO.File.WriteAllBytes(filePath, data);
Debug.Log($"Screenshot saved to: {filePath}");
// Clear the captured screenshot image.
NoaController.ClearCapturedScreenshot();
}
else
{
Debug.LogError("No screenshot data.");
}
}
}
// Example of executing a custom process without executing NOA Debugger’s screenshot process.
public class ExampleOriginalScreenshotManager : NoaScreenshotCallbacks
{
// Set IsAllowBaseScreenshot to false to prevent execution of NOA Debugger’s screenshot process.
public override bool IsAllowBaseScreenshot => false;
// Because the default display-control process is triggered, you can execute your custom capture process with NOA Debugger UI hidden.
public override void OnCaptureScreenshot()
{
ScreenCapture.CaptureScreenshot("screenshot.png");
}
}
#endif
