Checking for a class type issue

Hello guys, i have a list with different object types. And i want to take some from list. Im stuck in checking for needed type.

   public Type GetRandomSkill<Type>()
        List<Type> skills = new List<Type>();
        Debug.Log("checking for: " +typeof(Type));
        for (int i = 0; i < enemy_Skills.Length; i++)
            Debug.Log("current: "+enemy_Skills*.GetType());*

if (enemy_Skills*.GetType() == typeof(Type))


return skills[Random.Range(0,skills.Count)];
As you can see from console, checking type and needed type are equal on second iteration, however if brackets dont work.
I know issue is in this line if (enemy_Skills*.GetType() == typeof(Type)) but how to fix it?


You’re checking whether the object is the Type type. You probably want typeof(Skill) or something like that.