Skip to content

Commit ccdb6ff

Browse files
add error logs in case the private fields are no longer there
1 parent 5b47362 commit ccdb6ff

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

Packages/com.unity.inputsystem/InputSystem/Editor/Settings/EditorPlayerSettingHelpers.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,11 +164,21 @@ private static SerializedProperty GetPropertyOrNull(string name)
164164
// this will be replaced by a call to an API in the editor instead of using reflection once it is available
165165
var buildProfileType = typeof(BuildProfile);
166166
var globalPlayerSettingsField = buildProfileType.GetField("s_GlobalPlayerSettings", BindingFlags.Static | BindingFlags.NonPublic);
167+
if (globalPlayerSettingsField == null)
168+
{
169+
Debug.LogError($"Could not find global player settings field in build profile when trying to get property {name}. Please try to update the Input System package.");
170+
return null;
171+
}
167172
var playerSettings = (PlayerSettings)globalPlayerSettingsField.GetValue(null);
168173
var activeBuildProfile = BuildProfile.GetActiveBuildProfile();
169174
if (activeBuildProfile != null)
170175
{
171176
var playerSettingsOverrideField = buildProfileType.GetField("m_PlayerSettings", BindingFlags.Instance | BindingFlags.NonPublic);
177+
if (playerSettingsOverrideField == null)
178+
{
179+
Debug.LogError($"Could not find player settings override field in build profile when trying to get property {name}. Please try to update the Input System package.");
180+
return null;
181+
}
172182
var playerSettingsOverride = (PlayerSettings)playerSettingsOverrideField.GetValue(activeBuildProfile);
173183
if (playerSettingsOverride != null)
174184
playerSettings = playerSettingsOverride;

0 commit comments

Comments
 (0)