Following tutorial videos yet script doesn't work
Hello senpais,
So I was watching the very first tutorials as I am a beginner at Unity. The video of the rolling ball tutorial (Link at bottom) yet, even though I copied exactly what they showed my "player" did not want to move. Although if I used the script provided under the video it works, even though it seems to be exactly the same... I cannot seem to figure out why and would really appreciate help as I want to continue with Unity. Btw I use Unity 5.5.1f1 and Visual Studio to edit the script
My script
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PlayerController : MonoBehaviour{
public float speed;
private Rigidbody rb;
void Start ()
{
rb = GetComponent <Rigidbody>();
}
void Fixedupdate ()
{
float moveHorizontal = Input.GetAxis ("Horizontal");
float moveVertical = Input.GetAxis ("Vertical");
Vector3 movement = new Vector3 (moveHorizontal, 0.0f, moveVertical);
rb.AddForce (movement * speed);
}
}
Video's script
using UnityEngine;
using System.Collections;
public class PlayerController : MonoBehaviour {
public float speed;
private Rigidbody rb;
void Start ()
{
rb = GetComponent<Rigidbody>();
}
void FixedUpdate ()
{
float moveHorizontal = Input.GetAxis ("Horizontal");
float moveVertical = Input.GetAxis ("Vertical");
Vector3 movement = new Vector3 (moveHorizontal, 0.0f, moveVertical);
rb.AddForce (movement * speed);
}
}
https://unity3d.com/learn/tutorials/projects/roll-ball-tutorial/moving-player?playlist=17141
Your answer
Follow this Question
Related Questions
Words in my script don't turn blue, why not? (absolute script noob) 3 Answers
Survival Shooter Error CS0120 1 Answer
Tanks tutorial 'Input' issue 0 Answers
UnityEngine.GameObject' does not contain a definition for position 1 Answer
Uplaoding Games 3 Answers