So I have a class Skill, which is Serializable, and I want to add an inspector slot I can drag subclasses of Skill onto in order to customize those items in edit mode. My class currently reads:
using UnityEngine;
using System.Collections;
[System.Serializable]
public class Skill {
public string name;
public int id;
public float castTime;
public float cooldown;
public Skill(string skillName, int skillID, float skillCastTime, float skillCooldown){
name = skillName;
id = skillID;
castTime = skillCastTime;
cooldown = skillCooldown;
}
public void Use(GameObject npc){
}
}
I created a new variable of type Skill named itemSkill in my base item class, and in my database I’m trying to expose it with:
Skill itemSkill = EditorGUILayout.ObjectField(item.skillFunction, typeof(Skill), false);
However this generates an error, “The best overloaded match for `UnityEditor.EditorGUILayout.ObjectField(UnityEngine.Object, System.Type, params UnityEngine.GUILayoutOption)’ has some invalid arguments”. Is there an obvious syntax error, or am I not using EditorGUILayout properly?