#UnityEvent data
1 messages · Page 1 of 1 (latest)
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
Yeah, exactly
I don't think its stored in a way where I can easily get it? Unless I'm mistaken
It's serialized, you can either use SerializedProperty to get it
or you can use reflection
I tried very hard to find the right serializedproperty to get it but could only get it with a customeditor,
I've pretty much never touched reflection. I would love some advice on how to do what you homies are suggesting 😄
😦
I don't really know what you're struggling with with the serialized properties. Show your setup and what properties you're having trouble with
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
You find them by using FindProperty and FindPropertyRelative until you get land on the property you care about https://unity.huh.how/programming/editor-extensions/serialisation/serializedobject-how-to
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
Surely the UnityEvent is serialized somewhere, or you are making a PropertyDrawer
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
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?
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