From 274352d6650d3e2ac4d01e4577e22a8971d1b12f Mon Sep 17 00:00:00 2001 From: Sinai <49360850+sinai-dev@users.noreply.github.com> Date: Sun, 2 Jan 2022 19:55:09 +1100 Subject: [PATCH] fix ParameterHandler parsing Types --- src/Core/Tests/TestClass.cs | 13 +++++++++++-- src/UI/Widgets/EvaluateWidget/ParameterHandler.cs | 3 +++ 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/Core/Tests/TestClass.cs b/src/Core/Tests/TestClass.cs index 56f3abd..f261ef2 100644 --- a/src/Core/Tests/TestClass.cs +++ b/src/Core/Tests/TestClass.cs @@ -80,9 +80,18 @@ namespace UnityExplorer.Tests ExplorerCore.Log($"Test3 {typeof(T).FullName}"); } - public static void TestArgumentParse(string s, int i, Color color, CameraClearFlags flags, Vector3 vector, Quaternion quaternion, object obj) + public static void TestArgumentParse(string _string, + int integer, + Color color, + CameraClearFlags flags, + Vector3 vector, + Quaternion quaternion, + object obj, + Type type) { - ExplorerCore.Log($"{s}, {i}, {color.ToString()}, {flags}, {vector.ToString()}, {quaternion.ToString()}, {obj?.ToString() ?? "null"}"); + ExplorerCore.Log($"_string: {_string}, integer: {integer}, color: {color.ToString()}, flags: {flags}, " + + $"vector: {vector.ToString()}, quaternion: {quaternion.ToString()}, obj: {obj?.ToString() ?? "null"}," + + $"type: {type?.FullName ?? "null"}"); } private static void Init_Mono() diff --git a/src/UI/Widgets/EvaluateWidget/ParameterHandler.cs b/src/UI/Widgets/EvaluateWidget/ParameterHandler.cs index e632784..c71af61 100644 --- a/src/UI/Widgets/EvaluateWidget/ParameterHandler.cs +++ b/src/UI/Widgets/EvaluateWidget/ParameterHandler.cs @@ -97,6 +97,9 @@ namespace UnityExplorer.UI.Widgets { var input = this.inputField.Text; + if (typeof(Type).IsAssignableFrom(paramType)) + return ReflectionUtility.GetTypeByName(input); + if (paramType == typeof(string)) return input;