Hello all,
I’ve been googling and searching around on the forums here for a bit, but I cant really get a solid answer so I figured id make a post.
Im new to unity, and new to C#. Im currently working on the rollerball tutorial, and im having problems with the movement script. While googling I found another person copy/paste his script, and it worked. The problem im having is understanding why his did, and mine doesnt.
When I compare the two scripts side by side, the only difference I can see is that words like Input and Vector3 are lit up in the working script, and just plain black in my script. Ill copy paste the two at the end of this post.
When I erase Input and retype it, visual studio is not auto populating. Im sure this is a simple fix, and probably something want to facepalm over, but id appreciate any help yall can give. Id like to learn how to make the script work on my own instead of just copying it and continuing on not knowing what I did wrong.
Thanks!
My script --------
using UnityEngine;
using System.Collections;
public class testing : MonoBehaviour {
private Rigidbody rb;
private object moveVertical;
void Start ()
{
rb = GetComponent();
}
void FixedUpdate()
{
float moveHorizontal = Input.GetAxis (“Horizontal”)
float moveVertical = Input.GetAxis (“Vertical”)
Vector3 movement = new Vector3 (moveHorizontal, 0.0f, moveVertical);
rb.AddForce(movement);
}
}
Working script--------
using UnityEngine;
using System.Collections;
public class Playercontroller : MonoBehaviour {
private Rigidbody rb;
private object moveVertical;
void Start ()
{
rb = GetComponent();
}
void FixedUpdate()
{
float moveHorizontal = Input.GetAxis (“Horizontal”);
float moveVertical = Input.GetAxis (“Vertical”);
Vector3 movement = new Vector3 (moveHorizontal, 0.0f, moveVertical);
rb.AddForce(movement);
}
}