Skip to content

Commit e7f7b63

Browse files
committed
edited comments and small refactor of names (PR fix)
1 parent 696b057 commit e7f7b63

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

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

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,18 @@ namespace UnityEngine.InputSystem.Editor
1313
/// </remarks>
1414
public class InputSystemPluginControl
1515
{
16-
//At the time of InitializeOnLoad the packages are compiled and registered
17-
//InitializeOnLoad on classes (see GXDKSupport) and their static constructors are compiled before methods with InitializeOnLoadMethod attribute (like this one)
18-
//Therefore the order of registering platforms from plugins is guaranteed
16+
// Input system platform specific classes register with the input system via a class using InitializeOnLoad on static constructors.
17+
// Static constructors in classes that are tagged with the InitializeOnLoad attribute are called before methods using the InitializeOnLoadMethod attribute.
18+
// So the extra input system packages will be registered before this check which is done in InitializeOnLoadMethod.
1919
[InitializeOnLoadMethod]
2020
private static void CheckForExtension()
2121
{
2222
ThrowWarningOnMissingPlugin();
2323
}
2424

25-
//This static HashSet will be reset OnDomainReload and so it will be emptied and refilled every [InitializeOnLoad]]
26-
private static HashSet<BuildTarget> s_targetNoPluginNeeded = new HashSet<BuildTarget>()
25+
// This static HashSet will be reset OnDomainReload and so it will be reset every Domain Reload (at the time of InitializeOnLoad).
26+
// This is pre-populated with the list of platforms that don't need a extra platform specific input system package to add platform specific functionality.
27+
private static HashSet<BuildTarget> s_supportedBuildTargets = new HashSet<BuildTarget>()
2728
{
2829
BuildTarget.StandaloneOSX,
2930
BuildTarget.StandaloneWindows,
@@ -54,7 +55,7 @@ private static void CheckForExtension()
5455
static bool BuildTargetNeedsPlugin()
5556
{
5657
BuildTarget target = EditorUserBuildSettings.activeBuildTarget;
57-
foreach (var platform in s_targetNoPluginNeeded)
58+
foreach (var platform in s_supportedBuildTargets)
5859
{
5960
if (platform == target) return false;
6061
}
@@ -71,8 +72,7 @@ static bool BuildTargetNeedsPlugin()
7172
/// </remarks>
7273
public static void RegisterPlatform(BuildTarget target)
7374
{
74-
if (EditorUserBuildSettings.activeBuildTarget == target)
75-
s_targetNoPluginNeeded.Add(target);
75+
s_supportedBuildTargets.Add(target);
7676
}
7777

7878
private static bool IsPluginInstalled()

0 commit comments

Comments
 (0)