diff --git a/Packages/com.unity.inputsystem/InputSystem/Editor/InputSystemPluginControl.cs b/Packages/com.unity.inputsystem/InputSystem/Editor/InputSystemPluginControl.cs index bf0330ac57..c7c8cc1aab 100644 --- a/Packages/com.unity.inputsystem/InputSystem/Editor/InputSystemPluginControl.cs +++ b/Packages/com.unity.inputsystem/InputSystem/Editor/InputSystemPluginControl.cs @@ -5,7 +5,10 @@ namespace UnityEngine.InputSystem.Editor { - internal class InputSystemPluginControl + /// + /// This class controls all required plugins and extension packages are installed for the InputSystem. + /// + public class InputSystemPluginControl { //At the time of InitializeOnLoad the packages are compiled and registered [InitializeOnLoadMethod] @@ -42,6 +45,8 @@ private static void CheckForExtension() BuildTarget.NoTarget }; + private static bool m_pluginPackageRegistered = false; + static bool BuildTargetNeedsPlugin() { BuildTarget target = EditorUserBuildSettings.activeBuildTarget; @@ -54,12 +59,23 @@ static bool BuildTargetNeedsPlugin() private const string PlugInName = "com.unity.inputsystem."; + /// + /// Used to register extensions externally to the InputSystem, this is needed for all Platforms that require a plugin to be installed. + /// + public static void RegisterPluginPackage() + { + m_pluginPackageRegistered = true; + } + private static bool IsPluginInstalled() { + if (!m_pluginPackageRegistered) + return true; var registeredPackages = UnityEditor.PackageManager.PackageInfo.GetAllRegisteredPackages(); + var plugInName = PlugInName + EditorUserBuildSettings.activeBuildTarget.ToString().ToLower(); foreach (var package in registeredPackages) { - if (package.name.StartsWith(PlugInName)) + if (package.name.Equals(plugInName)) return true; } return false;