Button On Click in if

Hi,
I have few prefabs. Each prefab has attach script:

    private KeyCode e, q;
    public float degree;

    private void Awake()
    {
        e = KeyCode.E;
        q = KeyCode.Q;
    }

    // Update is called once per frame
    void Update () {

        if (Input.GetKeyDown(e))
        {
            degree -= 90f;
        }
        if (Input.GetKeyDown(q))
        {
            degree += 90f;
        }
        transform.rotation = Quaternion.Slerp(transform.rotation, Quaternion.Euler(degree, 0f, 0f), Time.deltaTime * 5f);
    }

It works very great if I use keys E and Q, but I want use for this too buttons. One button will change degree for -=90f, second button for +=90f.
I add this two buttons to scene. Now I have question for that. How I can make this? If I add this from my Assets folder to OnClick() in inspector for buttons in hierarchy, I don’t have any variables to change, or function to run.

You need to attach GameObject with this script, no just script.

I don’t have this prefabs in hierarchy, I have this only in assets folder.

Add an empty game object to your scene. Add a script that has your 2 methods on it, or use the script you had before with 2 methods added.
Then, in the OnClick for your 2 buttons, drag the newly made empty game object into the slot, and select from the drop down menu the appropriate method.