[RESOLVED]How to get all available parameters from target Component

I’m making a editor to count value from another component, but I need to get reference or access to all parameter of that component.
Actually this function from new UI system is exactly what I want. Any idea how to do this? Thanks :slight_smile:
[44612-leapcontrolpanel-2015416-下午-041109bmp.jpg|44612]

Sadly the documentation is not very helpful but here is how it works.

First you have to include the event namespace

using UnityEngine.Events;

Then you can define your event:

public UnityEvent myevent;

That should bring up the ui seen in your image.

If you like to invoke your event you can do it like this:

if (myevent != null) {
	myevent.Invoke();
}

if you like to use events with parameter you have to define them via a custome class like this

[System.Serializable]
public class MyIntEvent : UnityEvent<int>
{

}

Then you can create a variable of that custom event type

public MyIntEvent m_MyEvent;

If you want to access class members (i.e. fields, properties, methods…) you shall use reflection (System.Reflection namespace). Check MSDN docs.

Here’s a simple example that would get all the public fields defined in a Test class.

FieldInfo[] fields = typeof (Test).GetFields ();

Both @fffMalzbier and @frarees solution work out very well! UnityEvent way is much easier, But FieldInfo is more customizable when making Editor script. Very thanks both of you, I never know this before :slight_smile: