Editor.target cast works fine on the unity project, but on my external library dont.
Am I missing some assembly reference?
using UnityEngine;
using UnityEngine.UI;
using UnityEditor;
using UnityEditor.UI;
namespace HiddenClasses {
[CustomEditor(typeof(DropdownExpand), true), CanEditMultipleObjects]
public class DropdownExpandEditor : DropdownEditor {
private SerializedProperty maxItens;
protected override void OnEnable() {
base.OnEnable();
maxItens = serializedObject.FindProperty("maxItens");
}
public override void OnInspectorGUI() {
serializedObject.Update();
var maxi = maxItens.intValue;
MonoBehaviour b;
var num = (target as DropdownExpand).options.Count;
var size = (serializedObject.targetObject as DropdownExpand).itemText.transform.parent
.GetComponent().rect.height;
EditorGUILayout.LabelField("Itens: {0} Size: {1} Max Size: {2}".V(num, size, (maxi > 0 ? maxi : num) * size));
EditorGUILayout.PropertyField(maxItens);
serializedObject.ApplyModifiedProperties();
EditorGUILayout.Space();
//base.OnInspectorGUI();
}
}
}
Note the error says MonoBehavior doesnt exists but, a variable of that type is declared just a line before (for testing purpose)
![alt text][1]
[1]: /storage/temp/155332-cast-error.png
↧