issue with a random script c# (help)

Good evening everyone,

i need some help with this code. It says “the name instantiate does not exist in the current context” why is this and can you offer a fix for this code.

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class MonoBehaviour
{
    public GameObject[] objectsToSpawn;
    public Transform[] spawnPoints; // An Vector3 array can also be used
    public List<GameObject> spawnedObjects; // Containing all spawned Objects; Using List to simply call .Add(GameObject);
    public int spawnCount; // How many objects should be spawned
    private int objectIndex; // Random objectsToSpawn index
    private int spawnIndex; // Random spawnPoints index
    private void start ()
    {
        // Use this for loop to not hardcode the spawn count
        for (int i = 0; i < spawnCount; i++)
        {
            // For each iteration generate a random index; You could make an int array containing if an object already got spawned and change the index.
            objectIndex = Random.Range(0, objectsToSpawn.Length);
            spawnIndex = Random.Range(0, spawnPoints.Length);
            // Instantiate object
            GameObject go = Instantiate(objectsToSpawn[objectIndex], spawnPoints[spawnIndex].position, Quaternion.identity);
            // Add Object to spawnedObjects List
            spawnedObjects.Add(go);
        }
    }
}

thank you.

First and foremost, you haven’t named your class; you have it named after the class you intended to inherit from. So, call it something like:

public class MyClass : Monobehaviour

Although you seemed to have named your file sss.cs, which doesn’t follow C# naming practices which is an initial capital letter and camel-case thereafter.

Hope this helps.