- Home /
C# Parsing error
Hi there, i'm getting an error 8025 Parsing error with the following code. I'm very premature when it comes to programming, more of a modeller; so please help me learn what i'm doing wrong here!
using UnityEngine;
using System.Collections;
public caraccelerate accelerate
public class throttlehover : MonoBehaviour
{
void OnMouseEnter ()
{
renderer.material.color = Color.red;
}
void OnMouseExit ()
{
renderer.material.color = Color.white;
}
void OnMouseDown ()
{
accelerate.OnAccelerate()
}
}
Answer by aldonaletto · Feb 18, 2013 at 03:38 AM
Line 4 makes no sense:
public caraccelerate accelerate
I suppose that caraccelerate is another script - if so, move the line inside the class declaration and add a semicolon to its end, like this:
using UnityEngine;
using System.Collections;
public class throttlehover : MonoBehaviour
{
public caraccelerate accelerate; // move the line here
void OnMouseEnter ()
...
Remember to drag the object to which the script caraccelerate is attached to the field accelerate in the Inspector.
Answer by sona.viswam · Feb 18, 2013 at 04:12 AM
public caraccelerate accelerate and accelerate.OnAccelerate() are error lines.
using UnityEngine;
using System.Collections;
public class throttlehover : MonoBehaviour
{
public caraccelerate accelerate;
void OnMouseEnter ()
{
renderer.material.color = Color.red;
}
void OnMouseExit ()
{
renderer.material.color = Color.white;
}
void OnMouseDown ()
{
accelerate.OnAccelerate();
}
}
Your answer
Follow this Question
Related Questions
Unexpected Symbol 'end-of-file' C# Error CS8025 1 Answer
error CS8025: Parsing error 2 Answers
Problem parsing package with API level 29 2 Answers
Parsing Error with creating new shader script 0 Answers
Unexpected symbol 'private' ... 1 Answer