Question by
CCZUHUALOOKENGLH · Jul 12, 2017 at 07:26 AM ·
roll a ball
Why am i getting a Null Referencce Expectation in roll a ball?
using System.Collections; using System.Collections.Generic; using UnityEngine;
public class PlayerController : MonoBehaviour {
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 );
}
System.NullReferenceException: Object reference not set to an instance of an object at PlayerController.FixedUpdate () [0x0002c] in E:\周天彤团队建模VR与神经\Roll a ball\Assets\PlayerController.cs:20
Comment