syntax Error, ',' expected but im not actually missing anything

So I'm following the Unity learn tutorial, but it says my code is missing a ','. I've compared, and my code is identical to the example. I have to complete this for a project in class, but I'm kind of lost. It also says the error is on line 30 col 71. Pictures for reference 9461729--1329170--Lesson 2.4 - Collision Decisions - Unity Learn - Google Chrome 11_9_2023 2_02_48 PM.png 9461729--1329167--SpawnManager.cs - Visual Studio Code 11_9_2023 2_02_23 PM.png

EDIT: Wow, Unity’s site here:

Has an egregious error in the code.

The corrected code should read:

        void SpawnRandomAnimal()
        {
            Vector3 spawnpos = new Vector3(
                Random.Range(-xSpawnRange, xSpawnRange), 0, zSpawnPos);
            int animalIndex = Random.Range(0, animalPrefabs.Length);
            Instantiate(animalPrefabs[animalIndex], spawnpos,
                animalPrefabs[animalIndex].transform.rotation);
        }

Can someone like @MelvMay perhaps escalate?

The INCORRECT code reads:

Instantiate(animalPrefabs[animalIndex], new Vector3(0, 0, 20) spawnpos,
      animalPrefabs[animalIndex].transform.rotation);

and thus has the extra Vector3 expression immediately before the spawnpos argument.

alr, thanks for the advice! and I’ll make sure to use proper tags/formatting next time

I think there's probably supposed to be a "," between new Vector3(0, 0, 20) and spawnpos. These are two separate things.

Read again… that would be supplying TWO Vector3s to Instantiate(), which as last I checked was not a supported overload. :slight_smile:

It really is an error in the Unity PDF / Learn site.