So I have the basic MoveAround script form TornadoTwins. I apply it to my character, and i do have a CharacterController, but when i play the game, i can’t walk, i can only rotate, and it shows this in the Unity 3D console: NullReferenceException: Object reference not set to an instance of an object
MoveAround.Update () (at Assets/MyScripts/MoveAround.js:10)
Here’s the script:
var speed : float = 3.0;
var rotateSpeed : float = 3.0;
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);
}
@script RequireComponent(CharacterController)
I have a great idea for a game, and i’m trying to realize it, i’m not a professional (obviously) so any help would be appreciated!