Skip to content

Commit 5f2fe5c

Browse files
committed
Simplified code and removed recursive call.
1 parent dd3c867 commit 5f2fe5c

File tree

1 file changed

+10
-10
lines changed
  • Packages/com.unity.inputsystem/InputSystem/Utilities

1 file changed

+10
-10
lines changed

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

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -89,19 +89,19 @@ public Type LookupTypeRegistration(string name)
8989

9090
private Type TryLookupTypeRegistration(InternedString internedName)
9191
{
92-
if (table.TryGetValue(internedName, out var type))
93-
return type;
94-
95-
// Failed to look-up type, either type do not exist or it is a custom type that has not been registered.
96-
// Check whether we have attempted to load custom types and otherwise lazily load
97-
// types only when referenced and reattempt looking up type by name. (ISXB-1766)
98-
if (m_Manager != null)
92+
if (!table.TryGetValue(internedName, out var type))
9993
{
100-
if (m_Manager.RegisterCustomTypes())
101-
return TryLookupTypeRegistration(internedName); // Recursive call
94+
// Failed to look-up type, either type do not exist or it is a custom type that has not been registered.
95+
// Check whether we have attempted to load custom types and otherwise lazily load types only when
96+
// relevant and reattempt looking up type by name. (ISXB-1766)
97+
if (m_Manager != null)
98+
{
99+
if (m_Manager.RegisterCustomTypes())
100+
table.TryGetValue(internedName, out type);
101+
}
102102
}
103103

104-
return null;
104+
return type;
105105
}
106106

107107
#if UNITY_EDITOR

0 commit comments

Comments
 (0)