ok so this is my complete script on main object that has a spawnPoint for the bullet to spawn from t
he bulletprefab is tagged
and the bullet itself it fine
this also causes my unity to crash from time to time
the script is forming the bullet but the bullet isnt going anywhere and im getting this error
“Missing Field Expection: field unity engine. transform.tag not found”
boo.lang.runtime.dynamicdispatching.propertydispatcherfactory.findextension
(error line 15)
var speed : int = 5;
var rotateSpeed : int = 3;
static var bullets : int = 10;
var timer :float;
var bulletPrefab : Transform;
function Start () {
while(true){
while(!Input.GetButtonDown("Jump"))yield;
bullet = Instantiate(bulletPrefab, GameObject.Find("spawnPoint").transform.position, transform.rotation);
bullet.Tag = "bulletPrefab";
bullet.rigidbody.AddForce(bullet.forward *400);
}
}
function Update () {
var controller : CharacterController = GetComponent(CharacterController);
transform.Rotate(0, Input.GetAxis ("Horizontal") *rotateSpeed, 0);
var forward = transform.TransformDirection(Vector3.forward);
var curSpeed = speed * Input.GetAxis("Vertical");
controller.SimpleMove(forward * curSpeed);
}
function OnGUI(){
GUI.Label(Rect(10,10,200,50), "Timer:" + timer);
GUI.Label(Rect(10,30,200,50), "Bullets left:" + bullets);
}