Search Unity

Assets/Scripts/Player_Contoller.cs(25,12): error CS8025: Parsing error

Discussion in 'Scripting' started by brandonishere, Feb 27, 2015.

  1. brandonishere

    brandonishere

    Joined:
    Feb 27, 2015
    Posts:
    15
    This is my parsing error from the unity tutorial, Roll a Ball. Can someone please help me fix this error?


    using UnityEngine;
    using System.Collections;

    public class PlayerController : MonoBehaviour
    {
    public float speed;
    public GUIText countText;
    public GUIText winText;
    private int count;

    void start ()
    {
    count = 0;
    SetCountText ();
    winText.text = "";
    }

    float movehorizontal = Input.GetAxis("Horizontal");
    float movevertical = Input.GetAxis("Vertical");

    Vector3 movement = new Vector3(moveHorizontal, 0.0f, moveVertical);
    }
    rigidbody.AddForce movement .deltaTime

    void OnTriggerEnterCollider
    }//

    {
    if(other.gameObject.tag == "Pick-Up Object")
    {
    other.gameObject.SetActive(false);
    count = count + 1;
    SetCountText ();
    }
    }
    void SetCountText ()
    {
    countText.text = "Count: " + count.ToString();
    if(count >= 12)
    {
    winText.text = "YOU WIN";
    }
    }
     
  2. Dantus

    Dantus

    Joined:
    Oct 21, 2009
    Posts:
    5,667
    Please use code tags:
    http://forum.unity3d.com/threads/using-code-tags-properly.143875/

    Like that we can easily point you to the lines where you have issues. One mistake you made is e.g.
    Code (csharp):
    1. void start ()
    which should be
    Code (csharp):
    1. void Start ()
    with an upper case S. This is not the cause for the error, but you would have found it sooner or later.

    Your problem starts basically here:
    Code (csharp):
    1. float movehorizontal = Input.GetAxis("Horizontal");
    This has to be in a method, but you placed it directly in class, which does not work. This is usually in an Update method.
     
  3. brandonishere

    brandonishere

    Joined:
    Feb 27, 2015
    Posts:
    15
    -----

    "This has to be in a method, but you placed it directly in class, which does not work. This is usually in an Update method."

    I'm not using Mono Develop for scripting. I'm using Sublime Text 2 to script. So how can I fix it in Sublime Text? I'm not good at scripting so I'm not sure how to fix this. Also, I don't know what you mean by - "This has to be in a method, but you placed it directly in class, which does not work. This is usually in an Update method."

    Thanks, Brandon (A sophomore taking game design at Palm Springs High School)
     
    Last edited: Mar 4, 2015
  4. Dantus

    Dantus

    Joined:
    Oct 21, 2009
    Posts:
    5,667
    You don't have to use MonoDevelop to resolve issues. But if you want help, use code tags, like that e.g. indentations are preserved. Please post your code again.