I have this error, couldnt get my head around it. Any help appreciated:
Base Class:
namespace TOZ {
public abstract class ScriptableObjectBase<T> : ScriptableObject {
protected List<T> Data;
protected virtual void Awake() {
if(Data == null) {
Data = new List<T>();
}
}
public T this[int i] {
get { return Data[i]; } set { Data[i] = value; }
}
public int Count() {
return Data.Count;
}
}
}
Child class
namespace TOZ {
[CreateAssetMenu(fileName = "data", menuName = "TOZ/SO_Vector3", order = 1)]
public sealed class SO_Vector3 : ScriptableObjectBase<Vector3> {
}
}
Editor script:
namespace TOZEditor {
[CustomEditor(typeof(SO_Vector3))]
public sealed class CE_SO_Vector3 : Editor {
private SO_Vector3 obj;
private void OnEnable() {
obj = (SO_Vector3)target;
}
public override void OnInspectorGUI() {
int count = obj.Count();
for(int i = 0; i < count; i++) {
obj[i] = EditorGUILayout.Vector3Field("Index: " + i, obj[i]);
}
}
}
}
editor script gives an error on for loop while the previous line doesnt. Whats wrong here?