#UnityEvent data

1 messages · Page 1 of 1 (latest)

hexed notch
#

You should be able to just use C# reflection to get that info

void dock
#

If this info is already in the UnityEvent, why are you putting it here, public? I don't understand why you're not getting the data that already exists

hexed notch
#

Yeah, exactly

thorny wadi
#

I don't think its stored in a way where I can easily get it? Unless I'm mistaken

void dock
#

It's serialized, you can either use SerializedProperty to get it

#

or you can use reflection

thorny wadi
thorny wadi
#

😦

void dock
thorny wadi
#

I just don't know how to easily get these properties out of a UnityEvent

    public int m_Mode;
    public UnityEngine.Object m_Target;
    public string m_MethodName;
    public string m_TargetAssemblyTypeName;
    public string m_ObjectArgumentAssemblyTypeName;

I couldn't find anything on the docs or forums and only found out these specific names are stored by opening up a .prefab file in a text editor

void dock
thorny wadi
#

I see, so following that., is there a way I find those properties from an inherited UnityEvent? or are they unacessable because UnityEvent isn't from UnityEngine.Object

#

or would I need a custom class that stores a unityevent

void dock
#

Surely the UnityEvent is serialized somewhere, or you are making a PropertyDrawer

thorny wadi
#

Surely the UnityEvent is serialized somewhere

It absolutely could be, But I just could not manage to find it after hours of trying. I think because it's not UnityEngine.Object you can only get it if you have the SerializedObject of the class that contains it, which I wasn't able to get from my inherted UnityEvent.OnBeforeSerialize

#

There was pretty few resources online and most either used very specific string searches and/or customeditors for specific monobehaviours which ideally i'd like to avoid

void dock
#

I still don't really understand what you're doing, and you are confused by what I am asking. Can you please explain what the end outcome of all this is, why do you need this data exposed, what are you actually doing with it?

thorny wadi
#

I have a lot of designer friendly systems that use unityevents to trigger objectives or create an item and such. I wanna be able to track what these unityevents are doing to visualize how my objectives are hooked up, how many items are in the scene etc.

The issue is I don't know how to easily access those paramters I listed above, which are inside UnityEvent's but don't seem publically accessible

I wanted to just have a EnhancedEvent : UnityEvent class that gets all this data at some point (onserialising the unityevent was my first choice) and stores it inside a struct that other scripts can easily acess. But I don't know how to get this data from the EnhancedEvent