Original Question
public SerializedProperty DrawQuad;
public override void OnInspectorGUI()
{
if(GUILayout.Button("Refresh"))
{
DrawQuad();//this block is wrong,so how to write?
}
}
Updated question
[CustomEditor(typeof(CustomQuad)), CanEditMultipleObjects]
public class Ins_Editor : Editor
{
public override void OnInspectorGUI()
{
if(GUILayout.Button("Refresh"))
{
DrawQuad();//just want call the function in CustomQuad Class, how can i do that?
}
}
You declared “DrawQuad” as SerializedProperty. So it’s not a method. So it can not “be called”. What are you trying to do here? You haven’t given enough information to give any reasonable answer. A SerializedProperty represents a data field in a serialized object. Did you even initialize it somewhere?
edit
Ok since we now have a little bit more information you probably want something like this:
public override void OnInspectorGUI()
{
if(GUILayout.Button("Refresh"))
{
((CustomQuad)target).DrawQuad();
}
}
[CustomEditor(typeof(CustomQuad)), CanEditMultipleObjects]
public class Ins_Editor : Editor
{
public override void OnInspectorGUI() {
if(GUILayout.Button(“Refresh”)) {
DrawQuad();//just want call the function in CustomQuad Class, how can i do that?
}
}
}