- Home /
Lots of Duplicate Questions about this...
Getting three kinds of errors even after following the tutorial!
I am new to unity and am making my first game using the tutorial given by unity about making that ball rolling game.After creating the script for the player movement i get three errors namely CS0619, CS1061 and an internal error.Checked the whole script five times,and i had written same as the tutorial but still got the errors.Please help me by giving the answer by editing the question.The C# script is as follows:
using UnityEngine;
using System.Collections;
public class Player_Controller : MonoBehaviour
{
void Fixedupdate()
{
float moveHorizontal = Input.GetAxis("Horizontal");
float moveVertical = Input.GetAxis("Vertical");
Vector3 movement = new Vector3(moveHorizontal, 0.0f, moveVertical);
rigidbody.AddForce(movement);
}
}
Answer by steakpinball · Mar 25, 2015 at 03:33 PM
Change rigidbody
to "GetComponent<Rigidbody>()"
https://docs.unity3d.com/ScriptReference/Component-rigidbody.html
The tutorial you are using hasn't been updated for Unity 5.
Follow this Question
Related Questions
Object reference not set to an instance of an object with Assembly-CSharp 0 Answers
Error:m TypeTree->m Index != -1 && m Overrides->size() 0 Answers
'Cannot Submit Change to Server' and Failing to Revert Project in Unity Collab 1 Answer
Unity wont enter play mode - compiler errors? 0 Answers
What compiling error is this?! 1 Answer