I have been following several tutorial series and have seen these two used in very similar ways, and was hoping someone could explain how they differ and, if possible, examp
There are two differences:
1.) GetComponent
finds a component only if it's attached to the same GameObject. GameObject.FindObjectOfType
on the other hand searches whole hierarchy and returns the first object that matches!
2.) GetComponent
returns only an object that inherits from Component
, while GameObject.FindObjectOfType
doesn't really care.