Field for calling a void

Hey all, simple question here.

I was wondering if there was a way to get the UI they use for buttons in another script. I have some functions I want to be called on some other scripts. I could program it in using GameObject.Find and GetComponent, but that wouldn’t be as generic as I’d like.

If not, I can resort to dragging GameObjects into a lit and use SendMessage(); on each of them, but that doesn’t seem that efficient… Anyway, if anyone has some tips, I’d love to hear them.

Thanks for your time!
-RiokuTheSlayer

Not exactly sure what you want, but i think what your looking for is the UnityEvent
to use this you will need to be using UnityEngine.Events namespace.

but its simple to use, just make a field of the type UnityEvent, than when you want to invoke it, use .Invoke() on it.

I mean that. I’ll check out the UnityEvent though, thanks

ya those are unity events, so should work like you want

It’s exactly what I want. Thanks.