Skip to content

Commit

Permalink
Add handling for implicit boolean conversion operators
Browse files Browse the repository at this point in the history
- Fix implicit boolean conversion operators that are defined on UnityEngine.Object types
  • Loading branch information
MerlinVR committed Mar 6, 2020
1 parent eec1a4c commit 2c20e9f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Assets/UdonSharp/Editor/UdonSharpExpressionCapture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -526,7 +526,7 @@ private SymbolDefinition CastSymbolToType(SymbolDefinition sourceSymbol, System.

foreach (MethodInfo methodInfo in methods)
{
if (methodInfo.ReturnType == targetType && methodInfo.GetParameters()[0].ParameterType == sourceSymbol.symbolCsType)
if (methodInfo.ReturnType == targetType && (methodInfo.GetParameters()[0].ParameterType == sourceSymbol.symbolCsType || methodInfo.GetParameters()[0].ParameterType == typeof(UnityEngine.Object)))
{
foundConversion = methodInfo;
break;
Expand Down
2 changes: 1 addition & 1 deletion Assets/UdonSharp/Editor/UdonSharpUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ public static bool IsImplicitlyAssignableFrom(this System.Type targetType, Syste

foreach (MethodInfo methodInfo in methods)
{
if (methodInfo.ReturnType == targetType && methodInfo.GetParameters()[0].ParameterType == assignee)
if (methodInfo.ReturnType == targetType && (methodInfo.GetParameters()[0].ParameterType == assignee || methodInfo.GetParameters()[0].ParameterType == typeof(UnityEngine.Object)))
return true;
}
}
Expand Down

0 comments on commit 2c20e9f

Please sign in to comment.