Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Can't Instantiate an object in UNITY3D

So I was trying to combine both the arcade game (https://www.youtube.com/watch?v=j48LtUkZRjU&list=PLPV2KyIb3jR53Jce9hP7G5xC4O9AgnOuL&index=1)

and the Dodge the Blocks game (https://www.youtube.com/watch?v=tyAutnOlsfA)

in order to make a never-ending level on the arcade.

I followed the arcade tutorial up to the point where you need to insert obstacles manually, then I tried to copy the system shown in the Dodge the blocks game, and wrote the following script:

using UnityEngine;

public class SpawnObstacle : MonoBehaviour
{
    public Transform[] spawnPoints;
    public GameObject obstacle;
    
//  this is on the start method only to check that it works, and it doesn't
    void start()
    {
        int randomIndex = Random.Range(0, spawnPoints.Length);

        for(int i = 0; i < spawnPoints.Length; i++)
        {
            if(randomIndex != i)
            {
                Instantiate(obstacle, spawnPoints[i].position, Quaternion.identity);
            }
        }
    }
}

The problem is, nothing happens. The code compiles just fine, but no obstacle object is being spawned.

PLEASE HELP ME!!! I'm getting desperate.

Thanks

Sign In or Register to comment.