Can someone help me? No matter what I change it still says "Parsing error".
Im trying to have a character from the First person POV walk up to a door, press "E" and have it play an animation to open that door. Then press "F" and play a closing animation. I've created this animation in Unity, can someone help me? Sorry if this is a stupid question, but I can't seem to fix it. Here is my code:
using UnityEngine; using System.Collections;
public class DoorOpenClose : MonoBehaviour {
// Use this for initialization
void Start() {
//open door when pressing "e" and close door when "f" is pressed
//Door open animation titled "UnityDoor"
//Door close animation titled "UnityDoorClose" }
// Update is called once per frame
void Update() {
{
if (Input.GetKeyDown("E"))
animation.Play("UnityDoor");
}
}
Answer by Effervescence · Aug 16, 2016 at 03:30 PM
@art_phoenix_ Looks like you forgot the closing curly brace for the class? Assuming you entered your code accurately.
Should be like this:
using UnityEngine;
using System.Collections;
public class DoorOpenClose : MonoBehaviour
{
// Use this for initialization
void Start()
{
//open door when pressing "e" and close door when "f" is pressed
//Door open animation titled "UnityDoor"
//Door close animation titled "UnityDoorClose" }
}
void Update()
{
{
//if (Input.GetKeyDown("E"))
//animation.Play("UnityDoor");
}
}
}
Awesome! It doesn't say parsing error anymore, now it's just telling me I need to make a backup because its outdated? $$anonymous$$eh, I'll figure it out. Thank You for solving my parsing error!! :D
Answer by Spinach_Chicken · Aug 16, 2016 at 03:27 PM
It looks like you need this } at the end of your script. When it says "Parsing Error" it normally means you need to fix your brackets.
Your answer
Follow this Question
Related Questions
how do i fix all compiler errors so i can enter playmode? 4 Answers
Array index is out of range. 1 Answer
not all code paths return a value? 1 Answer
Errors in code 2 Answers
parsing error 1 Answer