hello to all, sorry for my english, it is terrible, i know. I’m a very newbie with unity, and i’m making an android game.
My problem is on my shooting script, i’ve isn’t even finished him yet and i’m already getting errors D=
Here is my code:
using UnityEngine;
using System.Collections;
public class ShooterBehaviour : MonoBehaviour {
public Transform Bullet;
public int bulletNumber;
public float fireRate;
public float currentRate;
Transform[] bulletList;
void Start () {
Transform[] bulletList = new Transform [bulletNumber];
for (int i = 0; i < bulletNumber; i++){
bulletList *= Instantiate (Bullet, transform.position, transform.rotation) as Transform;*
-
}*
-
}*
-
void Update () {*
-
if(Input.GetKeyDown("space")){*
-
Debug.Log("was pressed!");*
-
Debug.Log("its time to fire!");*
-
bulletList[1].gameObject.SetActive(true);*
-
}*
-
}*
}
When i press the space bar, i was supposed to fire the first bullet from my array, but instead, i get one nullReferenceException. Does anyone can help me?