- Home /
This question was
closed Jan 07, 2015 at 07:47 PM by
Graham-Dunnett for the following reason:
Duplicate Question
Assets/Scripts/PlayerController.cs(22,25): error CS8025: Parsing error
I can't for the life of me figure out what I am doing wrong. I know this error means I am missing a "}" somewhere but I can't find it. Yes I am a noob at this.
using UnityEngine;
using System.Collections;
public class PlayerController : MonoBehaviour
{
public float speed;
void FixedUpdate()
{
float moveHorizontal = Input.GetAxis ("Horizontal");
float moveVertical = Input.GetAxis ("Vertical");
Vector3 movement = new Vector3(moveHorizontal,0.0f,moveVertical);
rigidbody.AddForce (movement * speed * Time.deltaTime);
}
void OnTriggerEnter(Collider other)
{
if(other.gameObject.tag == "PickUp")
{
other.gameObject.SetActive (false);
}
Comment
You should have matching opening and closing curly braces, you can see from your indentation that you do not.
using UnityEngine;
using System.Collections;
public class PlayerController : $$anonymous$$onoBehaviour
{
public float speed;
void FixedUpdate()
{
float moveHorizontal = Input.GetAxis ("Horizontal");
float moveVertical = Input.GetAxis ("Vertical");
Vector3 movement = new Vector3(moveHorizontal,0.0f,moveVertical);
rigidbody.AddForce (movement * speed * Time.deltaTime);
}
void OnTriggerEnter(Collider other)
{
if(other.gameObject.tag == "PickUp")
{
other.gameObject.SetActive (false);
}
}
}
Follow this Question
Related Questions
Strange errors with GUI.skin 1 Answer
RigidBodys and Scripts equals Error. 2 Answers
It is not possible to invoke an expression of type 'UnityEngine.GameObject'? 1 Answer
Parsing Error 2 Answers