Skip to content

Commit 5080817

Browse files
MiroBrodlovaUnityGitjfreire-unityekcoh
authored
FIX: Migrate Mono APIs to CoreCLR-compatible APIs (#2289)
Co-authored-by: João Freire <joao.freire@unity3d.com> Co-authored-by: Håkan Sidenvall <hakan.sidenvall@unity3d.com>
1 parent a9d60ae commit 5080817

File tree

5 files changed

+35
-0
lines changed

5 files changed

+35
-0
lines changed

Assets/Tests/InputSystem/CoreTests_Controls.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@
1717
using UnityEngine.Profiling;
1818
using UnityEngine.TestTools.Constraints;
1919
using Is = NUnit.Framework.Is;
20+
#if UNITY_6000_5_OR_NEWER
21+
using UnityEngine.Assemblies;
22+
#endif
2023

2124
partial class CoreTests
2225
{
@@ -1545,7 +1548,11 @@ public void Controls_PrecompiledLayouts_AllChildControlPropertiesHaveSetters()
15451548
var inputDevice = typeof(InputDevice);
15461549
var inputControlType = typeof(InputControl);
15471550
var checkedTypes = new HashSet<Type>();
1551+
#if UNITY_6000_5_OR_NEWER
1552+
foreach (var assembly in CurrentAssemblies.GetLoadedAssemblies())
1553+
#else
15481554
foreach (var assembly in AppDomain.CurrentDomain.GetAssemblies())
1555+
#endif
15491556
{
15501557
try
15511558
{

Packages/com.unity.inputsystem/InputSystem/Editor/BuildPipeline/LinkFileGenerator.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@
1111
using UnityEditor.Compilation;
1212
using UnityEditor.UnityLinker;
1313
using UnityEngine.InputSystem.Layouts;
14+
#if UNITY_6000_5_OR_NEWER
15+
using UnityEngine.Assemblies;
16+
#endif
1417

1518
namespace UnityEngine.InputSystem.Editor
1619
{
@@ -40,7 +43,11 @@ public string GenerateAdditionalLinkXmlFile(BuildReport report, UnityLinkerBuild
4043
var currentAssemblyName = typeof(UnityEngine.InputSystem.InputSystem).Assembly.GetName().Name;
4144

4245
var typesByAssemblies = new Dictionary<System.Reflection.Assembly, Type[]>();
46+
#if UNITY_6000_5_OR_NEWER
47+
var assemblies = CurrentAssemblies.GetLoadedAssemblies();
48+
#else
4349
var assemblies = AppDomain.CurrentDomain.GetAssemblies();
50+
#endif
4451
foreach (var assembly in assemblies)
4552
{
4653
try

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55
using UnityEditor.UIElements;
66
using UnityEngine.InputSystem.Utilities;
77
using UnityEngine.UIElements;
8+
#if UNITY_6000_5_OR_NEWER
9+
using UnityEngine.Assemblies;
10+
#endif
811

912
////REVIEW: generalize this to something beyond just parameters?
1013

@@ -50,7 +53,11 @@ internal static Type LookupEditorForType(Type type)
5053
if (s_TypeLookupCache == null)
5154
{
5255
s_TypeLookupCache = new Dictionary<Type, Type>();
56+
#if UNITY_6000_5_OR_NEWER
57+
foreach (var assembly in CurrentAssemblies.GetLoadedAssemblies())
58+
#else
5359
foreach (var assembly in AppDomain.CurrentDomain.GetAssemblies())
60+
#endif
5461
{
5562
foreach (var typeInfo in assembly.DefinedTypes)
5663
{

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@
1616
using UnityEngine.InputSystem.Layouts;
1717
using Unity.Profiling;
1818
using UnityEngineInternal.Input;
19+
#if UNITY_6000_5_OR_NEWER
20+
using UnityEngine.Assemblies;
21+
#endif
1922

2023
#if UNITY_EDITOR
2124
using UnityEngine.InputSystem.Editor;
@@ -2069,7 +2072,11 @@ internal bool RegisterCustomTypes()
20692072

20702073
var inputSystemAssembly = typeof(InputProcessor).Assembly;
20712074
var inputSystemName = inputSystemAssembly.GetName().Name;
2075+
#if UNITY_6000_5_OR_NEWER
2076+
var assemblies = CurrentAssemblies.GetLoadedAssemblies();
2077+
#else
20722078
var assemblies = AppDomain.CurrentDomain.GetAssemblies();
2079+
#endif
20732080
foreach (var assembly in assemblies)
20742081
{
20752082
try

Packages/com.unity.inputsystem/Tests/TestFixture/InputTestFixture.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@
1212
using UnityEngine.TestTools;
1313
using UnityEngine.TestTools.Utils;
1414
using UnityEngine.InputSystem.XR;
15+
#if UNITY_6000_5_OR_NEWER
16+
using UnityEngine.Assemblies;
17+
#endif
1518

1619
#if UNITY_EDITOR
1720
using UnityEditor;
@@ -241,7 +244,11 @@ private bool IsUnityTest()
241244
var type = Type.GetType(className);
242245
if (type == null)
243246
{
247+
#if UNITY_6000_5_OR_NEWER
248+
foreach (var assembly in CurrentAssemblies.GetLoadedAssemblies())
249+
#else
244250
foreach (var assembly in AppDomain.CurrentDomain.GetAssemblies())
251+
#endif
245252
{
246253
type = assembly.GetType(className);
247254
if (type != null)

0 commit comments

Comments
 (0)