GetComponentInChildren vs SerializeField in Prefab

Hello. In “Player Spawn Point” lecture Sam used [SerializeField] to get spawn point from Portal prefab. Why not “GetComponentInChildren”? Is it to get possibility to use other spawn points or to dont get confused with other child object if it will be in the future and minimize dependency?

It’s a little more performant. Imagine the following; I give you ‘A Tale of Two Cities by Charles Dickens’ or I ask you to go find it in the library. Which gets you the book quicker?

But it also affords us a little more flexibility - as you’ve mentioned - to specify other spawn points, perhaps even with code

1 Like

Thanks for reply :grinning:

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms