Skip to content

Commit cf2863a

Browse files
committed
changed plugin control to be check platform name and added register extention package method
1 parent 9c5879e commit cf2863a

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

Packages/com.unity.inputsystem/InputSystem/Editor/InputSystemPluginControl.cs

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,10 @@
55

66
namespace UnityEngine.InputSystem.Editor
77
{
8-
internal class InputSystemPluginControl
8+
/// <summary>
9+
/// This class controls all required plugins and extension packages are installed for the InputSystem.
10+
/// </summary>
11+
public class InputSystemPluginControl
912
{
1013
//At the time of InitializeOnLoad the packages are compiled and registered
1114
[InitializeOnLoadMethod]
@@ -42,6 +45,8 @@ private static void CheckForExtension()
4245
BuildTarget.NoTarget
4346
};
4447

48+
private static bool m_pluginPackageRegistered = false;
49+
4550
static bool BuildTargetNeedsPlugin()
4651
{
4752
BuildTarget target = EditorUserBuildSettings.activeBuildTarget;
@@ -54,12 +59,23 @@ static bool BuildTargetNeedsPlugin()
5459

5560
private const string PlugInName = "com.unity.inputsystem.";
5661

62+
/// <summary>
63+
/// Used to register extensions externally to the InputSystem, this is needed for all Platforms that require a plugin to be installed.
64+
/// </summary>
65+
public static void RegisterPluginPackage()
66+
{
67+
m_pluginPackageRegistered = true;
68+
}
69+
5770
private static bool IsPluginInstalled()
5871
{
72+
if (!m_pluginPackageRegistered)
73+
return true;
5974
var registeredPackages = UnityEditor.PackageManager.PackageInfo.GetAllRegisteredPackages();
75+
var plugInName = PlugInName + EditorUserBuildSettings.activeBuildTarget.ToString().ToLower();
6076
foreach (var package in registeredPackages)
6177
{
62-
if (package.name.StartsWith(PlugInName))
78+
if (package.name.Equals(plugInName))
6379
return true;
6480
}
6581
return false;

0 commit comments

Comments
 (0)