When I use FindObjectOfType<> and GameObject.FindObjectOfType<> it's bringing me to the same result but I don't know what the difference is between them.
When I use FindObjectOfType<> and GameObject.FindObjectOfType<> it's bringing me to the same result but I don't know what the difference is between them.
it's the same function with the same logic. But how can this be? Let me explain:
Docs: https://docs.unity3d.com/ScriptReference/Object.FindObjectOfType.html
Checking the documentation, it looks like this is a static function declared on the Object
public static T FindObjectOfType();
Static functions, have nothing to do with the object state of the object and can only manipulate static (shared in a sense between all objects) data.
Now, every other object in C#, inherits from the Object and so does the GameObject. So effectively, when you are calling the GameObject.FindObjectOfType you are calling by inheritance the original function.
Does this make sense?