- Home /
 
               Question by 
               HitarthPadaliya · Oct 22, 2020 at 03:52 AM · 
                editor-scriptingfunctionserializedpropertyserializedobjectclass object  
              
 
              Call a function of a custom class through a SerializedProperty
I have a custom class with the following code below :-
 public class MyClass
 {
      public void Debug ()
      {
           Debug.Log ("Debugging");
      }
 }
In the editor class of MyClass, I have a serialized property controlling this class. How do I call Debug () function from the SerializedProperty. Is there any function like CallFunction () mentioned below?
 [CustomEditor (typeof (MyClass))]
 public class CustomClass : Editor
 {
       public override void OnInspectorGUI ()
      {
           SerializedProperty myClass_prop;
 
           if (GUILayout.Button ("Check Debug"))
           {
                myClass_prop.CallFunction ("Debug");
           }
      }
 }
Thanks in advance.
               Comment
              
 
               
              Your answer
 
 
             Follow this Question
Related Questions
Calling ApplyModifiedProperties results in other variables resetting to 0? 0 Answers
Get UnityEvent reference from SerializedProperty 1 Answer
Replicate "Apply" and "Revert" button functionality in ScriptableObject Editor Inspector 2 Answers
Changing isExpanded property from another Editor 0 Answers
Why are the children of my Serialized Property not being drawn? 1 Answer
 koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                