mercredi 28 décembre 2022

Why does Assembly.GetType not get the type that exists in the target Assembly?

Assembly UnityEditorAssembly = Assembly.Load("UnityEditor");
Type[] allType = UnityEditorAssembly.GetTypes();
for (int i = 0; i < allType.Length; i++)
{
    if (allType[i].Name== "SceneAsset")
    Debug.LogError(allType[i].Name);
}
Type targetType = UnityEditorAssembly.GetType("SceneAsset",false,false);
Debug.LogError(targetType);

When I tried to get the SceneAsset type in UnityEditor by reflection, I could not get the target by Assembly.GetType, but by traversing to prove that the type existed at runtime. I wondered why





Aucun commentaire:

Enregistrer un commentaire