From b7758c3e41daaff03eb9a7b0a88948c3229a429f Mon Sep 17 00:00:00 2001 From: hatayama Date: Wed, 8 Jul 2026 17:27:16 +0900 Subject: [PATCH] Share missing Input System package warning text Centralize the repeated missing Input System package guidance so the four input-tool fallback responses stay byte-identical through one formatter. --- ...putSystemPackageRequirementMessageTests.cs | 34 +++++++++++++++++++ ...stemPackageRequirementMessageTests.cs.meta | 11 ++++++ .../InputSystemPackageRequirementMessage.cs | 20 +++++++++++ ...putSystemPackageRequirementMessage.cs.meta | 11 ++++++ .../RecordInput/RecordInputUseCase.cs | 2 +- .../ReplayInput/ReplayInputUseCase.cs | 2 +- .../SimulateKeyboardUseCase.cs | 2 +- .../SimulateMouseInputUseCase.cs | 2 +- 8 files changed, 80 insertions(+), 4 deletions(-) create mode 100644 Assets/Tests/Editor/InputSystemPackageRequirementMessageTests.cs create mode 100644 Assets/Tests/Editor/InputSystemPackageRequirementMessageTests.cs.meta create mode 100644 Packages/src/Editor/FirstPartyTools/Common/InputSystem/InputSystemPackageRequirementMessage.cs create mode 100644 Packages/src/Editor/FirstPartyTools/Common/InputSystem/InputSystemPackageRequirementMessage.cs.meta diff --git a/Assets/Tests/Editor/InputSystemPackageRequirementMessageTests.cs b/Assets/Tests/Editor/InputSystemPackageRequirementMessageTests.cs new file mode 100644 index 0000000000..bd01aeb156 --- /dev/null +++ b/Assets/Tests/Editor/InputSystemPackageRequirementMessageTests.cs @@ -0,0 +1,34 @@ +#nullable enable +using NUnit.Framework; + +using io.github.hatayama.UnityCliLoop.FirstPartyTools; + +namespace io.github.hatayama.UnityCliLoop.Tests.Editor +{ + /// + /// Verifies missing Input System package warning text shared by first-party input tools. + /// + [TestFixture] + public sealed class InputSystemPackageRequirementMessageTests + { + [TestCase( + "simulate-keyboard", + "simulate-keyboard requires the Input System package (com.unity.inputsystem). Install it via Package Manager and set Active Input Handling to 'Input System Package (New)' or 'Both' in Player Settings.")] + [TestCase( + "simulate-mouse-input", + "simulate-mouse-input requires the Input System package (com.unity.inputsystem). Install it via Package Manager and set Active Input Handling to 'Input System Package (New)' or 'Both' in Player Settings.")] + [TestCase( + "record-input", + "record-input requires the Input System package (com.unity.inputsystem). Install it via Package Manager and set Active Input Handling to 'Input System Package (New)' or 'Both' in Player Settings.")] + [TestCase( + "replay-input", + "replay-input requires the Input System package (com.unity.inputsystem). Install it via Package Manager and set Active Input Handling to 'Input System Package (New)' or 'Both' in Player Settings.")] + public void Format_WithToolName_ReturnsExistingWarningMessage(string toolName, string expected) + { + // Verifies the shared formatter preserves the existing wire-visible warning text. + string result = InputSystemPackageRequirementMessage.Format(toolName); + + Assert.That(result, Is.EqualTo(expected)); + } + } +} diff --git a/Assets/Tests/Editor/InputSystemPackageRequirementMessageTests.cs.meta b/Assets/Tests/Editor/InputSystemPackageRequirementMessageTests.cs.meta new file mode 100644 index 0000000000..6306d2a694 --- /dev/null +++ b/Assets/Tests/Editor/InputSystemPackageRequirementMessageTests.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 4322471909334d6791e1d4422443b8de +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Packages/src/Editor/FirstPartyTools/Common/InputSystem/InputSystemPackageRequirementMessage.cs b/Packages/src/Editor/FirstPartyTools/Common/InputSystem/InputSystemPackageRequirementMessage.cs new file mode 100644 index 0000000000..85db81b7bb --- /dev/null +++ b/Packages/src/Editor/FirstPartyTools/Common/InputSystem/InputSystemPackageRequirementMessage.cs @@ -0,0 +1,20 @@ +#nullable enable +using System.Diagnostics; + +namespace io.github.hatayama.UnityCliLoop.FirstPartyTools +{ + /// + /// Formats the shared missing Input System package warning for first-party input tools. + /// + internal static class InputSystemPackageRequirementMessage + { + private const string MissingPackageRequirement = + "requires the Input System package (com.unity.inputsystem). Install it via Package Manager and set Active Input Handling to 'Input System Package (New)' or 'Both' in Player Settings."; + + public static string Format(string toolName) + { + Debug.Assert(!string.IsNullOrEmpty(toolName), "toolName must identify the CLI tool."); + return $"{toolName} {MissingPackageRequirement}"; + } + } +} diff --git a/Packages/src/Editor/FirstPartyTools/Common/InputSystem/InputSystemPackageRequirementMessage.cs.meta b/Packages/src/Editor/FirstPartyTools/Common/InputSystem/InputSystemPackageRequirementMessage.cs.meta new file mode 100644 index 0000000000..6412493dfc --- /dev/null +++ b/Packages/src/Editor/FirstPartyTools/Common/InputSystem/InputSystemPackageRequirementMessage.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 02207cac5f0f4568950af7e9d356dd80 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Packages/src/Editor/FirstPartyTools/RecordInput/RecordInputUseCase.cs b/Packages/src/Editor/FirstPartyTools/RecordInput/RecordInputUseCase.cs index 03dd9e1be7..44b1b66f3b 100644 --- a/Packages/src/Editor/FirstPartyTools/RecordInput/RecordInputUseCase.cs +++ b/Packages/src/Editor/FirstPartyTools/RecordInput/RecordInputUseCase.cs @@ -41,7 +41,7 @@ public async Task RecordInputAsync( return new RecordInputResponse { Success = false, - Message = "record-input requires the Input System package (com.unity.inputsystem). Install it via Package Manager and set Active Input Handling to 'Input System Package (New)' or 'Both' in Player Settings.", + Message = InputSystemPackageRequirementMessage.Format("record-input"), Action = request.Action.ToString() }; #else diff --git a/Packages/src/Editor/FirstPartyTools/ReplayInput/ReplayInputUseCase.cs b/Packages/src/Editor/FirstPartyTools/ReplayInput/ReplayInputUseCase.cs index d8a8f13d86..829c485450 100644 --- a/Packages/src/Editor/FirstPartyTools/ReplayInput/ReplayInputUseCase.cs +++ b/Packages/src/Editor/FirstPartyTools/ReplayInput/ReplayInputUseCase.cs @@ -38,7 +38,7 @@ public async Task ReplayInputAsync( return new ReplayInputResponse { Success = false, - Message = "replay-input requires the Input System package (com.unity.inputsystem). Install it via Package Manager and set Active Input Handling to 'Input System Package (New)' or 'Both' in Player Settings.", + Message = InputSystemPackageRequirementMessage.Format("replay-input"), Action = request.Action.ToString() }; #else diff --git a/Packages/src/Editor/FirstPartyTools/SimulateKeyboard/SimulateKeyboardUseCase.cs b/Packages/src/Editor/FirstPartyTools/SimulateKeyboard/SimulateKeyboardUseCase.cs index 000c2b1f41..8700d0b39d 100644 --- a/Packages/src/Editor/FirstPartyTools/SimulateKeyboard/SimulateKeyboardUseCase.cs +++ b/Packages/src/Editor/FirstPartyTools/SimulateKeyboard/SimulateKeyboardUseCase.cs @@ -43,7 +43,7 @@ public async Task ExecuteAsync( return new SimulateKeyboardResponse { Success = false, - Message = "simulate-keyboard requires the Input System package (com.unity.inputsystem). Install it via Package Manager and set Active Input Handling to 'Input System Package (New)' or 'Both' in Player Settings.", + Message = InputSystemPackageRequirementMessage.Format("simulate-keyboard"), Action = parameters.Action.ToString() }; #else diff --git a/Packages/src/Editor/FirstPartyTools/SimulateMouseInput/SimulateMouseInputUseCase.cs b/Packages/src/Editor/FirstPartyTools/SimulateMouseInput/SimulateMouseInputUseCase.cs index 5b04b2e6fe..f19ea8a3dc 100644 --- a/Packages/src/Editor/FirstPartyTools/SimulateMouseInput/SimulateMouseInputUseCase.cs +++ b/Packages/src/Editor/FirstPartyTools/SimulateMouseInput/SimulateMouseInputUseCase.cs @@ -44,7 +44,7 @@ public async Task ExecuteAsync( return new SimulateMouseInputResponse { Success = false, - Message = "simulate-mouse-input requires the Input System package (com.unity.inputsystem). Install it via Package Manager and set Active Input Handling to 'Input System Package (New)' or 'Both' in Player Settings.", + Message = InputSystemPackageRequirementMessage.Format("simulate-mouse-input"), Action = parameters.Action.ToString() }; #else