Skip to content

Commit 3745677

Browse files
committed
fixup runtime compilation
1 parent 872662e commit 3745677

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

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

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3592,7 +3592,7 @@ internal static void InitializeInEditor(IInputRuntime runtime = null)
35923592
}
35933593

35943594
Debug.Assert(settings != null);
3595-
Debug.Assert(MiscHelpers.HasNativeObject(settings), "InputSettings has lost its native object");
3595+
Debug.Assert(HasNativeObject(settings), "InputSettings has lost its native object");
35963596

35973597
// If native backends for new input system aren't enabled, ask user whether we should
35983598
// enable them (requires restart). We only ask once per session and don't ask when
@@ -3695,6 +3695,16 @@ internal static void OnPlayModeChange(PlayModeStateChange change)
36953695
}
36963696
}
36973697

3698+
// We have this function to hide away instanceId -> entityId migration that happened in Unity 6.4
3699+
public static bool HasNativeObject(Object obj)
3700+
{
3701+
#if UNITY_6000_4_OR_NEWER
3702+
return EditorUtility.EntityIdToObject(obj.GetEntityId()) != null;
3703+
#else
3704+
return EditorUtility.InstanceIDToObject(obj.GetInstanceID()) != null;
3705+
#endif
3706+
}
3707+
36983708
private static void OnProjectChange()
36993709
{
37003710
////TODO: use dirty count to find whether settings have actually changed
@@ -3706,7 +3716,7 @@ private static void OnProjectChange()
37063716
// temporary settings object.
37073717
// NOTE: We access m_Settings directly here to make sure we're not running into asserts
37083718
// from the settings getter checking it has a valid object.
3709-
if (MiscHelpers.HasNativeObject(s_Manager.m_Settings))
3719+
if (HasNativeObject(s_Manager.m_Settings))
37103720
{
37113721
var newSettings = ScriptableObject.CreateInstance<InputSettings>();
37123722
newSettings.hideFlags = HideFlags.HideAndDontSave;

Packages/com.unity.inputsystem/InputSystem/Utilities/MiscHelpers.cs

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -37,15 +37,5 @@ public static int IndexOf<TValue>(this IEnumerable<TValue> enumerable, TValue va
3737
++index;
3838
return -1;
3939
}
40-
41-
// We have this function to hide away instanceId -> entityId migration that happened in Unity 6.4
42-
public static bool HasNativeObject(Object obj)
43-
{
44-
#if UNITY_6000_4_OR_NEWER
45-
return EditorUtility.EntityIdToObject(obj.GetEntityId()) != null;
46-
#else
47-
return EditorUtility.InstanceIDToObject(obj.GetInstanceID()) != null;
48-
#endif
49-
}
5040
}
5141
}

0 commit comments

Comments
 (0)