- Home /
Get List of Signatures of Messages to Monobehaviour
I would like to programmatically generate a list of all the messages that Monobehaviour can receive, something along the lines of:
void Awake();
...
void OnCollisionEnter(Collision other);
...
void Update();
Getting this as a list of MethodInfo instances would probably be most convenient, but text would be ok too.
I can't use reflection on Monobehaviour, because these messages are not members of Monobehaviour.
Thanks for any suggestions!
UPDATE: I ended up using a tool in JetBrains' resharper-unity plugin (apache license) called ApiParser that generates an xml file with the information I wanted (names, return types, parameter types of the messages). It uses the documentation, just as Bunny83 suggested in the answer below. From this, it was pretty easy to generate the source files that I wanted. Hopefully this will be easier and more robust than hand-coding the classes every time the api changes.
[1]: https://github.com/JetBrains/resharper-unity
Answer by Bunny83 · May 23, 2020 at 03:17 PM
That's not possible and also shouldn't be necessary. Most messages are generated and send by other components. So this list would never be complete. Apart from that on the managed side those messages are simply not known. So there is no place to look them up. The only place where they are documented is, well, in the documentation.
Your answer
Follow this Question
Related Questions
C# Creating my own custom Unity Messages 2 Answers
Is There a List of MonoBehaviour Messages That Are Still Called When Disabled? 1 Answer
How to echange a script of a component? 2 Answers
Which Monobehaviour messages get called in the inspector (scene not playing)? 0 Answers
How to rotate a projectile and mantain constant speed when hitting a wall? 2D 0 Answers