Getting position from a list of transforms

Hello,

In the video you write for SpawnAllEnemiesInWave the following

Instantiate(waveConfig.GetEnemyPrefab(), waveConfig.GetWaypoints()[0].transform.position, Quaternion.identity);

If you do “waveConfig.GetWaypoints()[0]” i think you get a Transform right?
So why first get the transform and then the position, and not directly the position?

Instantiate(waveConfig.GetEnemyPrefab(), waveConfig.GetWaypoints()[0].position, Quaternion.identity);

Kind regards,
Bert.

Hi Bert,

Welcome back to our community! :slight_smile:

Does your GetWaypoints()[0] return a Transform? If so, you are right. The .transform would be redundant.

Fortunately, it’s just a little flaw, not a real problem, which the reason why Rick won’t edit this video at the moment. Feel free to remove .transform in your project.

Has your question been answered?


See also:

1 Like

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

Privacy & Terms