How do I make a box in inspector appear that allows me to call functions in scripts similar to OnClick on Buttons?

Basically, I want to create a generic script that I can attach to objects that, when activated, calls a function within another script. I want to be able to pick which script is used and which function is called just like a button, but without the button (My plan is to raycast when the player hits the interact input, check if the object that was hit has this generic script, and if it does, activate it). Obviously though I don’t want to create tons of copies of this script for each different object with unique functionality.

Here’s a picture of what I’m talking about:
124435-capture.png

I just want to be able to use that with my script.

UnityEvent class is what you are looking for, something like this would do the trick:

public class MyClass : MonoBehaviour
    {
        public UnityEngine.Events.UnityEvent OnStartEvent;

        private void Start()
        {
            OnStartEvent.Invoke();
        }
    }

Cheers

well i’d sugest you build your own editor.

but that will take some time! and could be frustrating!

are there many gameobjects, which you want to handle this way?