hello everyone, i’m following the Book Unity 3.x GD Essentials (btw a great book)
but i’m pretty stuck in the end of chapter 02 (and it’s just the beginning xD)
the goal is to create an instance of Prefab Bullet to shoot on a Wall.
i did the scripting, re-read myself more than two times, compared with the step by step. but still getting an Error:
Assets/Shooter.js(13,55): BCE0023: No appropriate version of 'UnityEngine.Object.Instantiate' for the argument list '(UnityEngine.Rigidbody, UnityEngine.Vector3, UnityEngine.Vector3)' was found.
Here’s the code done (attached to the camera):
var bullet : Rigidbody;
var power : float = 1500;
var moveSpeed : float = 5;
function Update () {
var h : float = Input.GetAxis("Horizontal") * Time.deltaTime * moveSpeed;
var v : float = Input.GetAxis("Vertical") * Time.deltaTime * moveSpeed;
transform.Translate(h, v, 0);
if (Input.GetButtonUp("Fire1"))
{
var instance : Rigidbody = Instantiate(bullet, transform.position, transform.position);
var fwd : Vector3 = transform.TransformDirection(Vector3.forward);
instance.AddForce(fwd * power);
}
}
i hope someone can help here, Thanks in Advance !!