fix ParameterHandler parsing Types

This commit is contained in:
Sinai 2022-01-02 19:55:09 +11:00
parent 7b477a8b0e
commit 274352d665
2 changed files with 14 additions and 2 deletions

View File

@ -80,9 +80,18 @@ namespace UnityExplorer.Tests
ExplorerCore.Log($"Test3 {typeof(T).FullName}"); 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() private static void Init_Mono()

View File

@ -97,6 +97,9 @@ namespace UnityExplorer.UI.Widgets
{ {
var input = this.inputField.Text; var input = this.inputField.Text;
if (typeof(Type).IsAssignableFrom(paramType))
return ReflectionUtility.GetTypeByName(input);
if (paramType == typeof(string)) if (paramType == typeof(string))
return input; return input;