NoaDebugger v1.2.0NoaDebugger v1.2.0
  • v1.6.0
  • v1.5.0
  • v1.4.0
  • v1.3.0
  • v1.2.0
  • v1.1.0
  • v1.0.0
Demo
Contact
Buy
  • 日本語
  • English
  • 日本語
  • English
  • 日本語
  • English
  • 日本語
  • English
  • 日本語
  • English
  • 日本語
  • English
  • 日本語
  • English
  • v1.6.0
  • v1.5.0
  • v1.4.0
  • v1.3.0
  • v1.2.0
  • v1.1.0
  • v1.0.0
Demo
Contact
Buy
  • 日本語
  • English
  • 日本語
  • English
  • 日本語
  • English
  • 日本語
  • English
  • 日本語
  • English
  • 日本語
  • English
  • 日本語
  • English
  • NoaDebug

NoaDebug

Through this class, you can control the initialization and launch of NOA Debugger from the script.

APIs

Static Methods

APIDescription
Initialize()Initializes the tool.
Show()Launches the tool and opens a last displayed menu.
Show(index, isCustomMenu)Launches the tool and opens a specified menu. If isCustomMenu is true, it opens the custom menu.
Hide()Closes the tool and display the targeted floating window.
SetDebuggerActive(isActive)Toggles the display/hide of the tool.
SetFloatingWindowActive(isActive)Toggles the display/hide of the tool's floating window.
SetTriggerButtonActive(isActive)Toggles the display/hide of the tool's launch button.
SetFont(fontAsset, fontMaterial, fontSizeRate)Configure the fonts used for the tool. If fontMaterial is omitted, the default material of the specified font asset will be applied. If fontSizeRate is omitted, it will be treated as a 1:1 size.
EnableWorldSpaceRendering(worldCamera)Displays the tool on the world coordinates. If the arguments are omitted, the MainCamera is applied to the Canvas drawing. While displayed on the world coordinates, the floating window and the launch button are not displayed.
DisableWorldSpaceRendering()Displays the tool on 2D screen coordinates.
Destroy()Destroys the tool.
TakeScreenshot(callback)Returns the image data captured from the screenshot to the specified callback function.
In cases where a screenshot is taken during a crash, the process may not work correctly because the rendering may not be complete.

Static Properties

APIDescription
OnShowCallback that is fired when the tool is launched. You can get the index value of the menu when the callback is fired.
OnHideCallback that is fired when the tool is closed. You can get the index value of the menu when the callback is fired.
OnMenuChangedThis is a callback that is fired when the tool menu is switched. You can get the index value of the menu after the switch and a flag indicating whether it is a custom menu when the callback is fired.
RootTransformReturns a reference to the most top-level Transform of the tool.
IsInitializedReturns true if the tool is initialized.
IsWorldSpaceRenderingEnabledReturns true if the tool is being displayed on the world coordinates.
IsDebuggerVisibleReturns true if the tool is displayed.
IsTriggerButtonVisibleReturns true if the tool's launch button is displayed.
IsFloatingWindowVisibleReturns true if the dedicated window is displayed.

Sample Code

using UnityEngine;
#if NOA_DEBUGGER
using NoaDebugger;
#endif

public class Example
{
    void ExampleMethod()
    {
#if NOA_DEBUGGER
        // Initialize the tool.
        NoaDebug.Initialize();

        // Check if the tool has been initialized.
        bool isDebuggerInit = NoaDebug.IsInitialized;

        // Specify a callback to execute when the tool is launched.
        NoaDebug.OnShow = (index) => Debug.Log($"showIndex:{index}");

        // Open the last displayed menu of the tool.
        NoaDebug.Show();

        // Specify a callback to execute when the tool is closed.
        NoaDebug.OnHide = (index) => Debug.Log($"hideIndex:{index}");

        // Close the tool.
        NoaDebug.Hide();

        // Open the specified index of the tool.
        NoaDebug.Show(3);

        // Specify a callback to execute when the tool menu is switched.
        NoaDebug.OnMenuChanged = (index, isCustomMenu) => Debug.Log($"menuIndex:{index} isCustomMenu:{isCustomMenu}");

        // Hide the tool.
        NoaDebug.SetDebuggerActive(false);

        // Show the tool.
        NoaDebug.SetDebuggerActive(true);

        // Hide the tool's floating window.
        NoaDebug.SetFloatingWindowActive(false);

        // Show the tool's floating window.
        NoaDebug.SetFloatingWindowActive(true);

        // Hide the tool's launch button.
        NoaDebug.SetTriggerButtonActive(false);

        // Show the tool's launch button.
        NoaDebug.SetTriggerButtonActive(true);

        // Set the tool's font.
        var assetBundle = AssetBundle.LoadFromFile($"{Application.streamingAssetsPath}/ExampleFont");
        var fontAsset = assetBundle.LoadAsset<TMP_FontAsset>("Assets/AssetBundleResources/ExampleFont.asset");
        NoaDebug.SetFont(fontAsset, fontAsset.material, 1.0f);

        // Display the tool on the world coordinates.
        NoaDebug.EnableWorldSpaceRendering(Camera.main);

        // Get a reference to the most top-level Transform of the tool.
        Transform noaDebuggerRoot = NoaDebug.RootTransform;

        // Change the tool's coordinates, rotation angle, and scale.
        // - This is only applied when displayed on world coordinates.
        // - Please control the size change with scale.
        // - Since the canvas size of NOA Debugger is 1136x640, it will be approximately 3x1.7m in the following example.
        noaDebuggerRoot.localPosition = Vector3.zero;
        noaDebuggerRoot.localEulerAngles = Vector3.zero;
        noaDebuggerRoot.localScale = new Vector3(0.00264f, 0.00264f, 0.00264f);

        // Change the tool's layer.
        noaDebuggerRoot.gameObject.layer = 0;

        // Whether the tool is displayed on world coordinates.
        bool isWorldSpace = NoaDebug.IsWorldSpaceRenderingEnabled;

        // Display the tool on 2D screen coordinates.
        NoaDebug.DisableWorldSpaceRendering();

        // Check if the tool is displayed.
        bool IsDebuggerVisible = NoaDebug.IsDebuggerVisible;

        // Check if the tool's launch button is displayed.
        bool IsTriggerButtonVisible = NoaDebug.IsTriggerButtonVisible;

        // Check if the floating window is displayed.
        bool IsFloatingWindowVisible = NoaDebug.IsFloatingWindowVisible;

        // Execute the disposal of the tool.
        NoaDebug.Destroy();

        // Capture a screenshot
        NoaDebug.TakeScreenshot((data) => {
            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}");
            }
            else
            {
                Debug.LogError("Failed to capture screenshot.");
            }
        });
#endif
    }
}