I’m following and old tut by the tornadotwins. I was pretty sure I typed in everything right. Code is as follows.
var speed = 7.0;
var rotateSpeed = 3.0;
var bullitPrefab:Transform;
function Update ()
{
var controller : CharacterController = GetComponent.();
//Rotatearoundy- axis
transform.Rotate(0, Input.GetAxis (“Horizontal”) * rotateSpeed, 0);
//Moveforward/ backward
var forward = transform.TransformDirection(Vector3.forward);
var curSpeed = speed * Input.GetAxis (“Vertical”);
controller.SimpleMove(forward * curSpeed);
if(Input.GetButtonDown(“Jump”))
{
var bullit = Instantiate(bullitPrefab, GameObject.Find(“spawnpoint”).transform.position, Quaternion.identity);
bullit.Rigidbody.AddForce(Transform.Forward * 2000);
}
}
@script RequireComponent(CharacterController)
This is the error I’m getting when pressing space bar. The bullit is spawned but does not move.
NullReferenceException: Object reference not set to an instance of an object
Boo.Lang.Runtime.RuntimeServices.InvokeBinaryOperator (System.String operatorName, System.Object lhs, System.Object rhs)
move around.Update () (at Assets/scripts/Character Scripts/move around.js:21)
Google search suggests code may be being read as Boo?
I’ved tried some fixes, like adding script to the bullet, but it seems to compound the problem. Any help would be appreciated.
Another thing, seems odd that monodevelope does not seem to recognize some words such as find, or identity. ( It does not highlight it like I’m seeing in the video.)
I’d like to be able to finish a few tuts, start to finish to get the hang of learning Unity, so if any one has other suggestions for tuts, let me know. also it looks like learning script is going to be very important. I’d like to spend an hour a day on a “guided project” tut, another on a Coding tut, and finally on a blender tut, preferably all working on same thing or similar subjects.
If it wasn’t apparent, I’m a Noob, and want to get good, fast. But, I’m stuck.
So thanks in advance!