NOA DebuggerNOA Debugger
  • v1.7.0
  • v1.6.1
  • v1.5.0
  • v1.4.0
  • v1.3.0
  • v1.2.0
  • v1.1.1
  • v1.0.0
Demo
Contact
Buy
  • 日本語
  • English
  • 日本語
  • English
  • 日本語
  • English
  • 日本語
  • English
  • 日本語
  • English
  • 日本語
  • English
  • 日本語
  • English
  • 日本語
  • English
  • v1.7.0
  • v1.6.1
  • v1.5.0
  • v1.4.0
  • v1.3.0
  • v1.2.0
  • v1.1.1
  • v1.0.0
Demo
Contact
Buy
  • 日本語
  • English
  • 日本語
  • English
  • 日本語
  • English
  • 日本語
  • English
  • 日本語
  • English
  • 日本語
  • English
  • 日本語
  • English
  • 日本語
  • English
  • NoaDownloadCallbacks

NoaDownloadCallbacks

Configure events related to downloads.

By passing a class that inherits NoaDownloadCallbacks to NOA Debugger’s public property, you can customize download-related events.

Overridable Members

Methods

NameDescription
OnBeforeDownload(info)The method that is executed before the download process. Both the argument and return value are NoaDownloadInfo described below. If you return edited values, they will be reflected in NOA Debugger’s download process and in OnAfterDownload.
OnAfterDownload(info, status)The method that is executed after the download process. This method is executed even if NOA Debugger’s download process was not executed.

Properties

NameDescription
IsAllowBaseDownloadDetermines whether to execute NOA Debugger’s download process. Default is true; if set to false, the download process will not executed.

Related Types

INoaDownloadCallbacks

The overridable methods and properties of NoaDownloadCallbacks 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 NoaDownloadCallbacks class.

NoaDownloadInfo

A struct that holds information related to downloads, used across methods in NoaDownloadCallbacks.

ParameterDescription
FileNameThe download file name including extension.
JsonThe text that becomes the contents of the download file.

NoaDownloadStatus

An enum representing the result of the download process, used as an argument to OnAfterDownload.

ItemDescription
SucceededStatus when NOA Debugger’s download succeeds.
Note: In web environments only, because completion cannot be detected, this status is returned.
FailedStatus when NOA Debugger’s download fails for some reason, such as an error or cancellation.
NotExecutedStatus when NOA Debugger’s download was not executed.

Sample Code

#if NOA_DEBUGGER
using NoaDebugger;
using UnityEngine;

// Example of executing events before and after NOA Debugger’s download process.
public class ExampleDownloader : NoaDownloadCallbacks
{
    public override NoaDownloadInfo OnBeforeDownload(NoaDownloadInfo info)
    {
        // Edit the name of the file to be downloaded.
        info.FileName = $"Sample-{info.FileName}";

        // Log the text to be downloaded.
        Debug.Log(info.Json);

        return info;
    }

    public override void OnAfterDownload(NoaDownloadInfo info, NoaDownloadStatus status)
    {
        // Execute processing according to the post-download status.
        // info.FileName will contain the value edited in OnBeforeDownload.
        switch (status)
        {
            case NoaDownloadStatus.Succeeded:
                Debug.Log($"Download succeeded: {info.FileName}");
                break;

            case NoaDownloadStatus.Failed:
                Debug.LogError($"Download failed: {info.FileName}");
                break;
        }
    }
}

// Example of executing a custom download process without executing NOA Debugger’s download process.
public class ExampleOriginalDownloader : NoaDownloadCallbacks
{
    // Set IsAllowBaseDownload to false to disable NOA Debugger’s download process.
    public override bool IsAllowBaseDownload => false;

    public override NoaDownloadInfo OnBeforeDownload(NoaDownloadInfo info)
    {
        // Execute custom processing.
        AppendToFile(info.Json);
        return info;
    }

    void AppendToFile(string jsonText)
    {
        // Example of appending to a local file instead of downloading.
        string filePath = System.IO.Path.Combine(Application.persistentDataPath, "log.txt");
        System.IO.File.AppendAllText(filePath, jsonText + "\n");
    }
}

// Example of controlling whether to execute NOA Debugger’s download process with a custom flag.
public class ExampleSwitchableDownloader : NoaDownloadCallbacks
{
    bool isAllowBaseDownload = true;
    public override bool IsAllowBaseDownload => isAllowBaseDownload;

    public override NoaDownloadInfo OnBeforeDownload(NoaDownloadInfo info)
    {
        // Example of logging instead of downloading when the download text is relatively short.
        if (info.Json.Length < 500)
        {
            Debug.Log(info.Json);
            isAllowBaseDownload = false;
        }
        return info;
    }
}
#endif

Links

Related Features

  • Information
  • Snapshot
  • ConsoleLog
  • APILog
  • About Download

Classes Used

  • NoaInformation
  • NoaSnapshot
  • NoaConsoleLog
  • NoaApiLog