diff --git a/Editor/Localization/ja.po b/Editor/Localization/ja.po
index dcebe08..051f51b 100644
--- a/Editor/Localization/ja.po
+++ b/Editor/Localization/ja.po
@@ -103,50 +103,6 @@ msgstr "Reporters"
msgid "List of Reporters to be called on Autopilot terminate."
msgstr "オートパイロット終了時に通知を行なうReporterを指定します"
-# Header: Error Handling Settings
-msgid "Error Handling Settings"
-msgstr "エラーハンドリング設定"
-
-# handleException
-msgid "Handle Exception"
-msgstr "例外を報告する"
-
-# handleException tooltip
-msgid "Notify when Exception detected in log"
-msgstr "例外ログを検知したらSlack通知します"
-
-# handleError
-msgid "Handle Error"
-msgstr "エラーを報告する"
-
-# handleError tooltip
-msgid "Notify when Error detected in log"
-msgstr "エラーログを検知したらSlack通知します"
-
-# handleAssert
-msgid "Handle Assert"
-msgstr "アサートを報告する"
-
-# handleAssert tooltip
-msgid "Notify when Assert detected in log"
-msgstr "アサートログを検知したらSlack通知します"
-
-# handleWarning
-msgid "Handle Warning"
-msgstr "警告を報告する"
-
-# handleWarning tooltip
-msgid "Notify when Warning detected in log"
-msgstr "警告ログを検知したらSlack通知します"
-
-# ignoreMessages
-msgid "Ignore Messages"
-msgstr "無視するメッセージ"
-
-# ignoreMessages tooltip
-msgid "Do not send notifications when log messages contain this string"
-msgstr "ログメッセージの中にこの文字列が含まれていたらSlack通知を行ないません"
-
# Autopilot実行ボタン
msgid "Run"
msgstr "実行"
@@ -384,6 +340,7 @@ msgstr "ステレオキャプチャモード"
msgid "The eye texture to capture when stereo rendering is enabled. Neither this nor Resolution Factor can be specified"
msgstr "ステレオレンダリングが有効な場合にどちらのカメラを使用するかを指定できます。拡大係数と同時には設定できません"
+
#: Editor/UI/Agents/UGUIPlaybackAgentEditor.cs
# recordedJson
@@ -395,6 +352,49 @@ msgid "JSON file recorded by AutomatedQA package"
msgstr "Automated QAパッケージのRecorded Playbackウィンドウで記録したjsonファイルを設定します"
+#: Editor/UI/Agents/ErrorHandlerAgent.cs
+
+# handleException
+msgid "Handle Exception"
+msgstr "例外を捕捉"
+
+# handleException tooltip
+msgid "Specify an Autopilot terminates or only reports when an Exception is detected in the log"
+msgstr "例外ログを検知したとき、オートパイロットを停止するか、レポート送信のみ行なうかを指定します"
+
+# handleError
+msgid "Handle Error"
+msgstr "エラーを検知"
+
+# handleError tooltip
+msgid "Specify an Autopilot terminates or only reports when an Error is detected in the log"
+msgstr "エラーログを検知したとき、オートパイロットを停止するか、レポート送信のみ行なうかを指定します"
+
+# handleAssert
+msgid "Handle Assert"
+msgstr "アサートを検知"
+
+# handleAssert tooltip
+msgid "Specify an Autopilot terminates or only reports when an Assert is detected in the log"
+msgstr "アサートログを検知したとき、オートパイロットを停止するか、レポート送信のみ行なうかを指定します"
+
+# handleWarning
+msgid "Handle Warning"
+msgstr "警告を検知"
+
+# handleWarning tooltip
+msgid "Specify an Autopilot terminates or only reports when an Warning is detected in the log"
+msgstr "警告ログを検知したとき、オートパイロットを停止するか、レポート送信のみ行なうかを指定します"
+
+# ignoreMessages
+msgid "Ignore Messages"
+msgstr "無視するメッセージ"
+
+# ignoreMessages tooltip
+msgid "Log messages containing the specified strings will be ignored from the stop condition. Regex is also available; escape is a single backslash (\)."
+msgstr "指定された文字列を含むログメッセージは停止条件から無視されます。正規表現も使用できます。エスケープは単一のバックスラッシュ (\) です"
+
+
#: Editor/UI/Loggers/ 共通
# description (same as AutopilotSettingsEditor.cs)
diff --git a/Editor/UI/Agents/ErrorHandlerAgentEditor.cs b/Editor/UI/Agents/ErrorHandlerAgentEditor.cs
new file mode 100644
index 0000000..f38ca22
--- /dev/null
+++ b/Editor/UI/Agents/ErrorHandlerAgentEditor.cs
@@ -0,0 +1,95 @@
+// Copyright (c) 2023-2024 DeNA Co., Ltd.
+// This software is released under the MIT License.
+
+using DeNA.Anjin.Agents;
+using UnityEditor;
+using UnityEngine;
+
+namespace DeNA.Anjin.Editor.UI.Agents
+{
+ ///
+ /// Editor GUI for ErrorHandlerAgent
+ ///
+ [CustomEditor(typeof(ErrorHandlerAgent))]
+ public class ErrorHandlerAgentEditor : UnityEditor.Editor
+ {
+ private const float SpacerPixels = 10f;
+
+ // @formatter:off
+ private static readonly string s_description = L10n.Tr("Description");
+ private static readonly string s_descriptionTooltip = L10n.Tr("Description about this Agent instance");
+ private SerializedProperty _descriptionProp;
+ private GUIContent _descriptionLabel;
+
+ private static readonly string s_handleException = L10n.Tr("Handle Exception");
+ private static readonly string s_handleExceptionTooltip = L10n.Tr("Specify an Autopilot terminates or only reports when an Exception is detected in the log");
+ private SerializedProperty _handleExceptionProp;
+ private GUIContent _handleExceptionLabel;
+
+ private static readonly string s_handleError = L10n.Tr("Handle Error");
+ private static readonly string s_handleErrorTooltip = L10n.Tr("Specify an Autopilot terminates or only reports when an Error is detected in the log");
+ private SerializedProperty _handleErrorProp;
+ private GUIContent _handleErrorLabel;
+
+ private static readonly string s_handleAssert = L10n.Tr("Handle Assert");
+ private static readonly string s_handleAssertTooltip = L10n.Tr("Specify an Autopilot terminates or only reports when an Assert is detected in the log");
+ private SerializedProperty _handleAssertProp;
+ private GUIContent _handleAssertLabel;
+
+ private static readonly string s_handleWarning = L10n.Tr("Handle Warning");
+ private static readonly string s_handleWarningTooltip = L10n.Tr("Specify an Autopilot terminates or only reports when an Warning is detected in the log");
+ private SerializedProperty _handleWarningProp;
+ private GUIContent _handleWarningLabel;
+
+ private static readonly string s_ignoreMessages = L10n.Tr("Ignore Messages");
+ private static readonly string s_ignoreMessagesTooltip = L10n.Tr("Log messages containing the specified strings will be ignored from the stop condition. Regex is also available; escape is a single backslash (\\).");
+ private SerializedProperty _ignoreMessagesProp;
+ private GUIContent _ignoreMessagesLabel;
+ // @formatter:on
+
+ private void OnEnable()
+ {
+ Initialize();
+ }
+
+ private void Initialize()
+ {
+ _descriptionProp = serializedObject.FindProperty(nameof(ErrorHandlerAgent.description));
+ _descriptionLabel = new GUIContent(s_description, s_descriptionTooltip);
+
+ _handleExceptionProp = serializedObject.FindProperty(nameof(ErrorHandlerAgent.handleException));
+ _handleExceptionLabel = new GUIContent(s_handleException, s_handleExceptionTooltip);
+
+ _handleErrorProp = serializedObject.FindProperty(nameof(ErrorHandlerAgent.handleError));
+ _handleErrorLabel = new GUIContent(s_handleError, s_handleErrorTooltip);
+
+ _handleAssertProp = serializedObject.FindProperty(nameof(ErrorHandlerAgent.handleAssert));
+ _handleAssertLabel = new GUIContent(s_handleAssert, s_handleAssertTooltip);
+
+ _handleWarningProp = serializedObject.FindProperty(nameof(ErrorHandlerAgent.handleWarning));
+ _handleWarningLabel = new GUIContent(s_handleWarning, s_handleWarningTooltip);
+
+ _ignoreMessagesProp = serializedObject.FindProperty(nameof(ErrorHandlerAgent.ignoreMessages));
+ _ignoreMessagesLabel = new GUIContent(s_ignoreMessages, s_ignoreMessagesTooltip);
+ }
+
+ ///
+ public override void OnInspectorGUI()
+ {
+ serializedObject.Update();
+
+ EditorGUILayout.PropertyField(_descriptionProp, _descriptionLabel);
+ GUILayout.Space(SpacerPixels);
+
+ EditorGUILayout.PropertyField(_handleExceptionProp, _handleExceptionLabel);
+ EditorGUILayout.PropertyField(_handleErrorProp, _handleErrorLabel);
+ EditorGUILayout.PropertyField(_handleAssertProp, _handleAssertLabel);
+ EditorGUILayout.PropertyField(_handleWarningProp, _handleWarningLabel);
+ GUILayout.Space(SpacerPixels);
+
+ EditorGUILayout.PropertyField(_ignoreMessagesProp, _ignoreMessagesLabel);
+
+ serializedObject.ApplyModifiedProperties();
+ }
+ }
+}
diff --git a/Editor/UI/Agents/ErrorHandlerAgentEditor.cs.meta b/Editor/UI/Agents/ErrorHandlerAgentEditor.cs.meta
new file mode 100644
index 0000000..ea057a6
--- /dev/null
+++ b/Editor/UI/Agents/ErrorHandlerAgentEditor.cs.meta
@@ -0,0 +1,3 @@
+fileFormatVersion: 2
+guid: ae3db68592ab4098ae95f3bc1a4f8146
+timeCreated: 1730767312
\ No newline at end of file
diff --git a/Editor/UI/Settings/AutopilotSettingsEditor.cs b/Editor/UI/Settings/AutopilotSettingsEditor.cs
index 85c3c7c..4df6549 100644
--- a/Editor/UI/Settings/AutopilotSettingsEditor.cs
+++ b/Editor/UI/Settings/AutopilotSettingsEditor.cs
@@ -45,18 +45,6 @@ public class AutopilotSettingsEditor : UnityEditor.Editor
private static readonly string s_reporters = L10n.Tr("Reporters");
private static readonly string s_reportersTooltip = L10n.Tr("List of Reporters to be called on Autopilot terminate.");
- private static readonly string s_errorHandlingSettingsHeader = L10n.Tr("Error Handling Settings");
- private static readonly string s_handleException = L10n.Tr("Handle Exception");
- private static readonly string s_handleExceptionTooltip = L10n.Tr("Notify when Exception detected in log");
- private static readonly string s_handleError = L10n.Tr("Handle Error");
- private static readonly string s_handleErrorTooltip = L10n.Tr("Notify when Error detected in log");
- private static readonly string s_handleAssert = L10n.Tr("Handle Assert");
- private static readonly string s_handleAssertTooltip = L10n.Tr("Notify when Assert detected in log");
- private static readonly string s_handleWarning = L10n.Tr("Handle Warning");
- private static readonly string s_handleWarningTooltip = L10n.Tr("Notify when Warning detected in log");
- private static readonly string s_ignoreMessages = L10n.Tr("Ignore Messages");
- private static readonly string s_ignoreMessagesTooltip = L10n.Tr("Do not send notifications when log messages contain this string");
-
private static readonly string s_runButton = L10n.Tr("Run");
private static readonly string s_stopButton = L10n.Tr("Stop");
private const float SpacerPixels = 10f;
@@ -93,18 +81,6 @@ public override void OnInspectorGUI()
EditorGUILayout.PropertyField(serializedObject.FindProperty(nameof(AutopilotSettings.reporters)),
new GUIContent(s_reporters, s_reportersTooltip));
- DrawHeader(s_errorHandlingSettingsHeader);
- EditorGUILayout.PropertyField(serializedObject.FindProperty(nameof(AutopilotSettings.handleException)),
- new GUIContent(s_handleException, s_handleExceptionTooltip));
- EditorGUILayout.PropertyField(serializedObject.FindProperty(nameof(AutopilotSettings.handleError)),
- new GUIContent(s_handleError, s_handleErrorTooltip));
- EditorGUILayout.PropertyField(serializedObject.FindProperty(nameof(AutopilotSettings.handleAssert)),
- new GUIContent(s_handleAssert, s_handleAssertTooltip));
- EditorGUILayout.PropertyField(serializedObject.FindProperty(nameof(AutopilotSettings.handleWarning)),
- new GUIContent(s_handleWarning, s_handleWarningTooltip));
- EditorGUILayout.PropertyField(serializedObject.FindProperty(nameof(AutopilotSettings.ignoreMessages)),
- new GUIContent(s_ignoreMessages, s_ignoreMessagesTooltip), true);
-
serializedObject.ApplyModifiedProperties();
GUILayout.Space(SpacerPixels);
@@ -136,11 +112,7 @@ private static void DrawHeader(string label)
// ReSharper disable once MemberCanBeMadeStatic.Global
internal void Stop()
{
- var autopilot = FindObjectOfType();
- if (autopilot)
- {
- autopilot.TerminateAsync(ExitCode.Normally, reporting: false).Forget();
- }
+ Autopilot.Instance.TerminateAsync(ExitCode.Normally, reporting: false).Forget();
}
internal void Launch()
diff --git a/README.md b/README.md
index 081ba11..207cebb 100644
--- a/README.md
+++ b/README.md
@@ -110,6 +110,9 @@ Set the Agents to run by scene crossing, independent of `Scene Agent Maps` and `
The specified agents will have the same lifespan as Autopilot (i.e., use `DontDestroyOnLoad`)
for specifying, e.g., `ErrorHandlerAgent` and `UGUIEmergencyExitAgent`.
+> [!WARNING]
+> Recommend set an [ErrorHandlerAgent](#ErrorHandlerAgent) to interrupt Autopilot if an exception occurs during execution.
+
#### Autopilot Run Settings
This item can also be overridden from the commandline (see below).
@@ -122,18 +125,6 @@ This item can also be overridden from the commandline (see below).
Reporters
Reporter to be called on Autopilot terminate.
-#### Error Handling Settings
-
-Set up a filter to catch abnormal log messages and notify using Reporter.
-
-
-
Handle Exception
Report when exception is detected in log
-
Handle Error
Report when error message is detected in log
-
Handle Assert
Report when assert message is detected in log
-
Handle Warning
Report when warning message is detected in log
-
Ignore Messages
Log messages containing this string will not be reported. Regex is also available, and escape is a single backslash (`\`).
-
-
### Generate and configure the Agent setting file (.asset)
@@ -200,10 +191,6 @@ For details on each argument, see the entry of the same name in the "Generate an
LIFESPAN_SEC
Specifies the execution time limit in seconds
RANDOM_SEED
Specifies when you want to fix the seed given to the pseudo-random number generator
TIME_SCALE
Specifies the Time.timeScale. Default is 1.0
-
HANDLE_EXCEPTION
Overwrites whether to report when an exception occurs with TRUE/FALSE
-
HANDLE_ERROR
Overwrites whether to report when an error message is detected with TRUE/FALSE
-
HANDLE_ASSERT
Overwrites whether to report when an assert message is detected with TRUE/FALSE
-
HANDLE_WARNING
Overwrites whether to report when an warning message is detected with TRUE/FALSE
In both cases, the key should be prefixed with `-` and specified as `-LIFESPAN_SEC 60`.
@@ -276,9 +263,6 @@ See **Anjin Annotations** below for more information.
This is an Agent that playback uGUI operations with the Recorded Playback feature of the [Automated QA](https://docs.unity3d.com/Packages/com.unity.automated-testing@latest) package.
-> [!NOTE]
-> The Automated QA package is in the preview stage. Please note that destructive changes may occur, and the package itself may be discontinued or withdrawn.
-
The following can be set in an instance (.asset file) of this Agent.
@@ -296,6 +280,14 @@ A screenshot of the operation by Automated QA is stored under `Application.persi
The `Application.persistentDataPath` for each platform can be found in the Unity manual at
[Scripting API: Application.persistentDataPath](https://docs.unity3d.com/ScriptReference/Application-persistentDataPath.html).
+> [!WARNING]
+> The Automated QA package outputs `LogType.Error` to the console when playback fails (e.g., the target Button cannot be found). The following setting is required to detect this and terminate the autopilot.
+> 1. Add [ErrorHandlerAgent](#ErrorHandlerAgent) and set `Handle Error` to `Terminate Autopilot`.
+> 2. Add [ConsoleLogger](#ConsoleLogger) and set `Filter LogType` to `Error` or higher.
+
+> [!NOTE]
+> The Automated QA package is in the preview stage. Please note that destructive changes may occur, and the package itself may be discontinued or withdrawn.
+
### DoNothingAgent
@@ -375,6 +367,32 @@ This Agent instance (.asset file) can contain the following.
+### ErrorHandlerAgent
+
+An Agent that detects abnormal log messages and terminates the Autopilot running.
+
+It should always be started at the same time as other Agents (that actually perform game operations).
+Generally, you add to `Scene Crossing Agents` in `AutopilotSettings`.
+If you want to change the settings for each Scene, use with `ParallelCompositeAgent`.
+
+This Agent instance (.asset file) can contain the following.
+
+
+
Handle Exception
Specify an Autopilot terminates or only reports when an Exception is detected in the log.
+ It can be overwritten with the command line argument -HANDLE_EXCEPTION, but be careful if multiple ErrorHandlerAgents are defined, they will all be overwritten with the same value.
+
Handle Error
Specify an Autopilot terminates or only reports when an Error is detected in the log.
+ It can be overwritten with the command line argument -HANDLE_ERROR, but be careful if multiple ErrorHandlerAgents are defined, they will all be overwritten with the same value.
+
Handle Assert
Specify an Autopilot terminates or only reports when an Assert is detected in the log.
+ It can be overwritten with the command line argument -HANDLE_ASSERT, but be careful if multiple ErrorHandlerAgents are defined, they will all be overwritten with the same value.
+
Handle Warning
Specify an Autopilot terminates or only reports when an Warning is detected in the log.
+ It can be overwritten with the command line argument -HANDLE_WARNING, but be careful if multiple ErrorHandlerAgents are defined, they will all be overwritten with the same value.
+
Ignore Messages
Log messages containing the specified strings will be ignored from the stop condition. Regex is also available; escape is a single backslash (`\`).
+
+
+> [!NOTE]
+> Recommend enabling a `Handle Exception` to interrupt Autopilot if an exception occurs during execution.
+
+
### EmergencyExitAgent
An Agent that monitors the appearance of the `EmergencyExitAnnotations` component in the `DeNA.Anjin.Annotations` assembly and clicks on it as soon as it appears.
@@ -409,7 +427,7 @@ The instance of this Logger (.asset file) can have the following settings.
Output File Path
Log output file path. Specify relative path from project root or absolute path. When run on player, it will be the Application.persistentDataPath.
- This setting can be overwritten with the command line argument -FILE_LOGGER_OUTPUT_PATH, but if multiple File Loggers are defined, they will all be overwritten with the same path.
+ It can be overwritten with the command line argument -FILE_LOGGER_OUTPUT_PATH, but be careful if multiple FileLoggers are defined, they will all be overwritten with the same value.
Filter LogType
To selective enable debug log message
Timestamp
Output timestamp to log entities
@@ -442,15 +460,15 @@ The instance of this Reporter (.asset file) can have the following settings.
Slack Token
OAuth token of Slack Bot used for notifications. If omitted, no notifications will be sent.
- This setting can be overwritten with the command line argument -SLACK_TOKEN.
+ It can be overwritten with the command line argument -SLACK_TOKEN, but be careful if multiple SlackReporters are defined, they will all be overwritten with the same value.
Slack Channels
Channels to send notifications. If omitted, not notified. Multiple channels can be specified by separating them with commas.
- This setting can be overwritten with the command line argument -SLACK_CHANNELS.
- The bot must be invited to the channel.
+ Note that the bot must be invited to the channel.
+ It can be overwritten with the command line argument -SLACK_CHANNELS, but be careful if multiple SlackReporters are defined, they will all be overwritten with the same value.
Mention Sub Team IDs
Comma-separated sub team IDs to mention when posting error reports.
Add @here
Add @here to the post when posting error reports.
Lead Text
Lead text for error reports. It is used in OS notifications. You can specify placeholders like a "{message}".
Message
Message body template for error reports. You can specify placeholders like a "{message}".
-
Color
Attachments color for error reports.
+
Color
Attachments color for error reports. Default color is same as Slack's "danger" red.
Screenshot
Take a screenshot for error reports. Default is on.
Post if completes
Also post a report if completed autopilot normally. Default is off.
@@ -728,7 +746,7 @@ git submodule add https://github.com/dena/Anjin.git Packages/com.dena.anjin
> [!WARNING]
> Required install packages for running tests (when adding to the `testables` in package.json), as follows:
> - [Unity Test Framework](https://docs.unity3d.com/Packages/com.unity.test-framework@latest) package v1.3.4 or later
-> - [Test Helper](https://github.com/nowsprinting/test-helper) package v1.0.0 or later
+> - [Test Helper](https://github.com/nowsprinting/test-helper) package v0.7.2 or later
Generate a temporary project and run tests on each Unity version from the command line.
diff --git a/README_ja.md b/README_ja.md
index 2ff25ef..2e4e8c1 100644
--- a/README_ja.md
+++ b/README_ja.md
@@ -108,6 +108,9 @@ Sceneごとに自動実行を行なうAgent設定ファイル(.asset)の対
指定されたAgentの寿命はオートパイロット本体と同じになります(つまり、`DontDestroyOnLoad` を使用します)。
たとえば、`ErrorHandlerAgent` や `UGUIEmergencyExitAgent` などを指定します。
+> [!WARNING]
+> 実行中に例外が発生した時点でオートパイロットを中断するために、[ErrorHandlerAgent](#ErrorHandlerAgent) の設定をお勧めします。
+
#### オートパイロット実行設定
この項目は、コマンドラインから上書きもできます(後述)。
@@ -120,18 +123,6 @@ Sceneごとに自動実行を行なうAgent設定ファイル(.asset)の対