Hey,
what I wanna do is the following:
public override void OnInspectorGUI()
{
Object[] skillsObj = Resources.LoadAll("Skills",typeof(GameObject));
string[] skillNames = new string[skillsObj.Length];
int i = 0;
foreach(Object skill in skillsObj)
{
skillNames *= skill.name;*
-
i++;*
-
}*
-
EditorGUI.BeginChangeCheck();*
index = EditorGUILayout.Popup(“Skill:”,index, skillNames, EditorStyles.popup);
-
if(EditorGUI.EndChangeCheck())*
-
{*
-
(this.target as EnemyClass).setRangedSkill((GameObject)skillsObj[index]);*
-
}*
- }*
This works fine, as long as I don’t hit the play button.
If I hit play, the variable I assign through the “setRangedSkill” function always gets changed to the value of the game object I am editing. So if I choose an option and then hit the “Apply” Button for the prefabs, everything works fine. But I just want to update this specific object, not the prefab.
Where am I making a mistake?