- Home /
Unexpected symbol `public' in class, struct, or interface member declaration
I kinda new to unity programming and I have no idea what's the problem ( I am trying to create a script that makes a platform move when the player steps on it and then return to it's original position when the player leaves it)
public class Moving_Platform_Script_2 : MonoBehaviour {
public Transform position1;
public Transform position2;
public float speed= 15f;
protected bool Switch = false;
protected bool start=false;
protected bool dummy=
public GameObject player;
public GameObject platform;
void FixedUpdate(){
if (start == true) {
if (transform.position == position2.position) {
Switch = true;
}
if (transform.position == position1.position) {
Switch = false;
}
}
if (start == false) {
transform.position = Vector3.MoveTowards (transform.position, position1.position, speed * Time.deltaTime);
// platform.transform.position(52.94994f,17.94283f,36.07398f);
}
}
void OnTriggerEnter (Collider other){
if (other.tag == "Player") {
start = true;
StartCoroutine( platformoperator() );
}
}
IEnumerator platformoperator(){
while (start==true){
if (Switch==true) {
transform.position = Vector3.MoveTowards (transform.position, position1.position, speed * Time.deltaTime);
// player.transform.position=Vector3.MoveTowards(transform.position, position1.position, speed*Time.deltaTime);
}
else {
transform.position = Vector3.MoveTowards (transform.position, position2.position, speed * Time.deltaTime);
// player.transform.position=Vector3.MoveTowards(transform.position, position2.position, speed*Time.deltaTime);
yield return null;
}
}
}
}
any help would be appreciated
Answer by NoseKills · May 15, 2014 at 09:19 PM
You have an unfinished line of code in your class: protected bool dummy=
The compiler is expecting a boolean value to be assigned here, but since the semicolon and value are missing, the next words it finds are public GameObject player;
on the next line... thus the error. It's not expecting the word public to be next.
Your answer
Follow this Question
Related Questions
Distribute terrain in zones 3 Answers
The name 'Joystick' does not denote a valid type ('not found') 2 Answers
Multiple Cars not working 1 Answer
Script doesn't enable even when enabled = true 0 Answers
Weird Edge Collider offset 0 Answers