Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Compiling Errors??

Discussion in 'Game Design' started by HyruleHero527, Apr 23, 2018.

  1. HyruleHero527


    Apr 23, 2018
    Hey guys, so I'm pretty new to unity, and I'm using the official "Roll a Ball" game tutorial on Youtube to understand the basics, and I'm writing some C# script.
    here's the script I wrote:

    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);


    code rollaball.PNG upload_2018-4-22_18-23-31.png

    i've managed to get all the bugs and errors out except for one. it's supposed to be on line 22 according to the error list, can someone help me?
  2. EternalAmbiguity


    Dec 27, 2014
    1. Ask scripting questions in the Scripting forum

    2. Make sure you're looking at the correct script (NewBehaviourScript, not PlayerController)