What's the difference between a method and a message?

In the Unity documentation for C#, OnTriggerEnter2D is categorized as a message derived from MonoBehaviour. But to me it looks the same as a method. What is the difference between a method and a message and when would I use one vs. the other?

I am new to coding, and C#, and Unity, and I am working with the following script which is from a tutorial I am following. I guess my question boils down to trying to understand how calling a method and creating/defining a new method are different.

 public class LoseCollider : MonoBehaviour {
     private LevelManager levelManager;
     void OnTriggerEnter2D(Collider2D trigger) {
     
         levelManager = GameObject.FindObjectOfType<LevelManager>();
         levelManager.LoadLevel ("Lose Screen");
     }    

My understanding is that a pre-existing method can be called from a script, and usually I would write the method name and insert some parameter, if applicable, and that’s it.

I also know that I can 1. create and define a new method (using brackets to define what it does), and 2. call it elsewhere in the script.

My confusion is that OnTriggerEnter2D looks like a method, but in the script above it seems like I am both calling it (which makes sense because it’s been defined by Unity) AND defining what that method does. My impression was that you would only define what a method does when you are creating a new one.

So that leaves me confused as to how can I define a method (put stuff between the brackets/curly braces) that has already been defined by Unity, which is what it seems the script is doing? So that’s why I thought that maybe the answer has to do with the fact that OnTriggerEnter2D is a message, not a method. Do messages work differently than methods?

It’s both. It might make a little more sense if you check out the SendMessage documentation. OnTriggerEnter2D isn’t defined in the base MonoBehaviour class, so you don’t have to specify override in your derived class. Instead Unity uses reflection to see if you’ve put a method named “OnTriggerEnter2D” in your class and if you have then it will call that method as needed. Same with Start, Update, etc. Unity refers to this general reflection-to-know-about-your-methods thing as messages. Probably not the best descriptor, but it is what it is.

They’re just telling you that the Physics system will automatically call that function at the right time.

One way of saying that is: the system sends an OnTriggerEnter message,
which is picked up by your OnTriggerEnter function.

I prefer thinking of OnTriggerEnter as a callback. You write it, plug it in, and the system knows to call it when it needs to. It’s the same either way. But a typical callback lets you name the function whatever you like, and you write the line plugging it in. So it sort of feels a little more messagey.

The difference between Messages and Public Methods is Whether or not Unity will call it automatically.
Messages e.g.Awake,OnCollisionStay,OnGUI,OnPreCull will call by Unity automatically,so their name is start with “On____”.
Method e.g.Invoke,StartCouroutine will not call by Unity automatically.

Actually,They are all “methods”,same code,same implemention.
Just distinguishing these two concepts makes it easier for you to understand which methods will be called automatically.

,The difference between Messages and Public Methods is Whether or not Unity will call it automatically.
Messages e.g.Awake,OnCollisionStay,OnGUI,OnPreCull will call by Unity automatically,so their name is start with “On____”.
Method e.g.Invoke,StartCouroutine will not call by Unity automatically.

Actually,They are all “methods”,same code,same implemention.
Just distinguishing these two concepts makes it easier for you to understand which methods will be called automatically.