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()
}
}
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.
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();
}
}