Accessing the methods inside of my unityEvent ?

Hi,

so I’m basically doing a bit of editor scripting to make my life easier.
In my scene, I have my gameObjects called Events, that hold my script “Event”. That script has a public uEvent, in order for me to set what events will be called by that gameObject.

5476161--560382--upload_2020-2-13_14-5-29.png

5476161--560385--upload_2020-2-13_14-8-17.png

To make it look better and overall make it more accessible, I want special gizmos to be displayed depending on what the unity Event calls. Here, I have put a sound logo gizmo as an example, but if in my unity Event I call an animation to be played, then I want my editor script to also display a gizmo that represents that my event calls an animation. Hope that’s clear enough.

So my real question is, how do I access the “content” of my unity Event ? How can I know if this event calls an animation, a sound, a particle system, etc ?
I have tried GetPersistentMethodName(), which indeed gives me the name of the method called, but does not specify on which component it is called. So if I play a sound or an animation, both will be “Play”, so that doesn’t work for me.

Thanks !

1 Like

Okay nevermind. I just found it litteraly 30seconds after… sigh

So In case someone needs it, there you go : myUnityEvent.GetPersistentTarget(1).GetType();