How can I get first component of type?

Viewed 57

I want to get the first MonoBehaviour component to run a public void function. I actually use ObjectReference.GetComponent<ComponentName>().FunctionName(); but it would take me so much time because there's multiple ObjectReference and that implicates that I can't use the same script name with diff source.

1 Answers
Related