diff --git a/RuntimeUnityEditor/Windows/Inspector/VariableFieldDrawer.cs b/RuntimeUnityEditor/Windows/Inspector/VariableFieldDrawer.cs index c8fe20f..8865019 100644 --- a/RuntimeUnityEditor/Windows/Inspector/VariableFieldDrawer.cs +++ b/RuntimeUnityEditor/Windows/Inspector/VariableFieldDrawer.cs @@ -601,7 +601,19 @@ private static void DrawInvokeWindowFunc(int id) { var arg = _currentlyInvokingParamsValues[index]; var param = methodParams[index]; - var obj = ClipboardWindow.TryGetObject(arg, out var clipboardObj) ? clipboardObj : Convert.ChangeType(arg, param.ParameterType); + var paramType = param.ParameterType; + var nullableParamType = Nullable.GetUnderlyingType(paramType); + if (nullableParamType != null) + { + if (string.IsNullOrEmpty(arg)) + { + paramArgs[index] = null; + continue; + } + paramType = nullableParamType; + } + + var obj = ClipboardWindow.TryGetObject(arg, out var clipboardObj) ? clipboardObj : Convert.ChangeType(arg, paramType); paramArgs[index] = obj; } catch (Exception e)