Im trying to make a Custom Editor, i go to use ‘target’ to access the instance of the script but it doesn’t seem to want to work?
I have my script set up
using UnityEngine;
using UnityEditor;
using System.Collections;
[CustomEditor(typeof(DialogInstance))]
public class DialogInstanceEditor : Editor {
public override void OnInspectorGUI () {
}
}
Although when I try to use target.varFromDialogInstance i get this error
error CS0201: Only assignment, call, increment, decrement, and new object expressions can be used as a statement
Yet if I set this
DialogInstance script = (DialogInstance) target;
I get the following error
error CS0236: A field initializer cannot reference the nonstatic field, method, or property `UnityEditor.Editor.target'
If i set
DialogInstance target;
Then I get this warning
warning CS0108: `DialogInstanceEditor.target' hides inherited member `UnityEditor.Editor.target'. Use the new keyword if hiding was intended