I did watch superroblox tutorials and did do same things as he did in in second tutorial.
Heres my script:
var Bullet : Rigidbody;
var Spawn : Transform;
function Start () {
}
function Update () {
if(Input.GetButtonDown("Fire1")){
Fire();
}
}
function Fire(){
var bullet1 = Instantiate(Bullet,Spawn.position,Spawn.Rotation);
}
And i got this error: NullReferenceException: Object reference not set to an instance of an object
Gun.Fire () (at Assets/Scripts/Gun.js:18)
Gun.Update () (at Assets/Scripts/Gun.js:13)
18 line:
var bullet1 = Instantiate(Bullet,Spawn.position,Spawn.Rotation);
13 line: Fire();
Sorry, but i’m first time at Unity.
I did Create empty for bullet spawn etc…