- Home /
How can you list all classes inside a namespace (such as UnityEngine) and every message method that class has?
I was able to list all methods from a given class by following this link: https://answers.unity.com/questions/657436/how-to-list-all-the-properties-and-methods-from-th.html
Though, I now need to get a list of every class a namespace has (such as every class from UnityEngine), which would be the list on the left: https://docs.unity3d.com/ScriptReference/AccelerationEvent.html (every class in the 'Classes' tab)
Furthermore, I want to know the 'Message Methods" found in a class. The methods from the first link seem to only be public and static methods, and even without flags I do not receive the 'Awake', 'Start' and so on methods, found here: https://docs.unity3d.com/ScriptReference/MonoBehaviour.html
Is there anything that allows us to receive a list of any of these?,I was able to list all methods from a given class by following this link: https://answers.unity.com/questions/657436/how-to-list-all-the-properties-and-methods-from-th.html
Though, I now need to get a list of every class a namespace has (such as every class from UnityEngine), which would be the list on the left: https://docs.unity3d.com/ScriptReference/AccelerationEvent.html (every class in the 'Classes' tab)
Furthermore, I want to know the 'Message Methods" found in a class. The methods from the first link seem to only be public and static methods, and even without flags I do not receive the 'Awake', 'Start' and so one methods, found here: https://docs.unity3d.com/ScriptReference/MonoBehaviour.html
Is there anything that allows us to receive a list of any of these?
Answer by TheRealRan · Nov 04, 2020 at 07:25 PM
I've found out how to get all the namespace classes: https://stackoverflow.com/questions/949246/how-can-i-get-all-classes-within-a-namespace
Though that didn't seem to work for me with unity namespaces so I had to use this one instead:
System.Reflection.Assembly[] assemblies = System.AppDomain.CurrentDomain.GetAssemblies();
Assembly unityEngine;
assemblies.ForEachItem(assembly =>
{
if (assembly.FullName == "UnityEngine, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null")
{
unityEngine = assembly;
foreach (Type type in unityEngine.GetTypes())
{
Debug.Log(type.Name);
}
}
});
Unfortunately it seems like we cannot get the "message methods".