如何将 Type.GetType() 与 List'1[UnityEngine.Vector3] 一起使用?

How can I use Type.GetType() with List'1[UnityEngine.Vector3]?

我目前正在使用:

    public static Type FindType(string qualifiedTypeName)
    {
        Type t = Type.GetType(qualifiedTypeName);

        if (t != null)
        {
            return t;
        }
        else
        {
            foreach (Assembly asm in AppDomain.CurrentDomain.GetAssemblies())
            {
                t = asm.GetType(qualifiedTypeName);
                if (t != null)
                    return t;
            }
            return null;
        }
      

@Alistar 来自这个 post 的荣誉:Type.GetType not working
但是,当涉及到来自 UnityEngine 的 Vector3 列表时,即使这样也不起作用。
我知道你也可以通过在末尾添加“,UnityEngine”来包含相关程序集,但它不起作用。

编辑:
澄清一下,我正在尝试使用字符串值

"System.Collections.Generic.List`1[UnityEngine.Vector3]"

实际列表类型可以是任何类型,并希望从此字符串中找到实际类型。这适用于常规列表和常规变量,但在涉及特殊列表类型时我得到 null 结果。

有什么想法吗?

您提供的字符串 不是 而是 AssemblyQualifiedName!

看起来它只是 Type.ToString 的结果。

例如List<string>AssemblyQualifiedName 看起来像这样:

System.Collections.Generic.List`1[[System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089

List<Vector3> 它将是

System.Collections.Generic.List`1[[UnityEngine.Vector3, UnityEngine.CoreModule, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null]], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089