Skip to content

Commit f086f66

Browse files
committed
Merge branch 'throw-error-nda-inputsystem-without-plugin' of https://github.com/Unity-Technologies/InputSystem into throw-error-nda-inputsystem-without-plugin
2 parents 6f1b2e3 + dde9e4b commit f086f66

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

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

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
using System;
12
using System.Linq;
23
using NUnit.Framework;
34
using UnityEditor;
@@ -12,7 +13,7 @@ private static void CheckForExtension()
1213
ThrowWarningOnMissingPlugin();
1314
}
1415

15-
private static readonly BuildTarget[] targetNoPluginNeeded = new BuildTarget[]
16+
private static readonly BuildTarget[] TargetNoPluginNeeded =
1617
{
1718
BuildTarget.StandaloneOSX,
1819
BuildTarget.StandaloneWindows,
@@ -35,26 +36,29 @@ private static void CheckForExtension()
3536
static bool BuildTargetNeedsPlugin()
3637
{
3738
BuildTarget target = EditorUserBuildSettings.activeBuildTarget;
38-
return !targetNoPluginNeeded.Contains(target);
39+
return !TargetNoPluginNeeded.Contains(target);
3940
}
4041

41-
private static string plugInName = "com.unity.inputsystem.";
42+
private const string PlugInName = "com.unity.inputsystem.";
43+
4244
private static bool IsPluginInstalled()
4345
{
4446
var registeredPackages = UnityEditor.PackageManager.PackageInfo.GetAllRegisteredPackages();
4547
foreach (var package in registeredPackages)
4648
{
47-
if (package.name.StartsWith(plugInName)) //TODO better ??
49+
if (package.name.StartsWith(PlugInName))
4850
return true;
4951
}
5052
return false;
53+
54+
5155
}
5256

5357
private static void ThrowWarningOnMissingPlugin()
5458
{
55-
if (BuildTargetNeedsPlugin() && !IsPluginInstalled())
56-
Debug.Log("No plugin installed!");
57-
// TODO Assert.
59+
if(!BuildTargetNeedsPlugin())
60+
return;
61+
Debug.Assert(IsPluginInstalled(),"Active Input Handling is set to InputSystem, but no Plugin for "+ EditorUserBuildSettings.activeBuildTarget+" was found. Please install the missing InputSystem package extensions.");
5862
}
5963
}
6064
}

0 commit comments

Comments
 (0)