Accessing methods from another script. C#

This is a long one. Thank you so much if you read it all and even more so if you try and help.

I don’t think it’s as simple as it sounds. I can’t use inheritance or getcomponent.

I’m extending the editor and have given one class to deal with all the GUI and the others to deal with the functionality. Now this may not be the best idea but it’s all I was able to come up with. Why did I do this? Because I can’t figure out how to divvy up my class’ single OnGUI() to multiple methods, each one containing code which results in different GUI makeup (not all windows are the same but only one function with which to edit them in, my conclusion was that I needed to use other classes to do this.)

It’s all quite complicated because I’ve just been throwing things around wildly.

 [MenuItem("FFToolKit/Open")]
    public static void ShowWindow()
    {
        EditorWindow.GetWindow(typeof(FFToolKit),false, "");
    }

    [MenuItem("FFToolKit/Create")]
    public static void Create()
    { 
    }

    [MenuItem("FFToolKit/Create/New ForceField/Sphere ForceField")]
    public static void SphereFF()
    {

        EditorWindow.GetWindow(typeof(FFToolKit), false, "Sphere Editor");

       


    }

    [MenuItem("FFToolKit/Create/New ForceField/Mesh ForceField")]
    public static void MeshForceField()
    {

        EditorWindow.GetWindow(typeof(FFToolKit), false, "Mesh Editor");

        

    }

My windows. Within the sphereFF method I was hoping on calling a method of my external SphereForceField class, then use the OnGUI() of the class it’s being called by to arrange my GUI. Why didn’t I just do all my code within the sphereFF method? Because that code requires me to inherit from MonoBehaviour as it uses the ’ Destroy(sphere.GetComponent());’ method, you get an error if you inherit from the UnityEditor and still try to use this method.

THERE MUST BE A BETTER WAY TO DO THIS, hopefully one which is simpler and actually works. Because now we come to the issue: I can’t figure out how to call the method I want from the SphereForceField class. I can’t inherit since C# wont allow me to, I have to inherit from UnityEditor in the script I’m calling from because that’s the one that has all the code above, dealing with the GUI elements and the windows. I also can’t use getcomponent, I tried:

FFToolKit = GetComponent<SphereForceField>(); 

It doesn’t recognize SphereForceField, I even used my noob logic; creating a namespace to using;but clearly I’m shoving the metaphorical cube through the metaphorical circular hole…

Is there a way for me to access the SphereForceField.cs methods?

Side note: This FFToolKit script is within an editor folder, the other is not. I’m going to google the possible significance of this.

I have a feeling Editor folder scripts compile into a different assembly then regular scripts. You should be able to see the assembly name in your solution browser. You then need to add a using statement for that assembly at the top of your script.

I could be wrong here. I don’t use editor scripting much yet.