I have these two scripts
using UnityEngine;
using System.Collections;
public class Boxes : MonoBehaviour {
private int collected = 0; //Set up a variable to store how many you've collected
public Transform EndZone; //Drag GameObject which should be animated in here.
public AudioClip collectedSound; //This is the sound that will play after you collect one
public GUIStyle mystyle;
//This is the text that displayed how many you've collected in the top left corner
void OnGUI(){
GUI.Label(new Rect(40, 10, 500, 500),"Boxes:" + collected + "/14", mystyle);
}
private void OnTriggerEnter(Collider other){ //Checks to see if you've collided with another object
if(other.CompareTag("collectable")){ //checks to see if this object is tagged with "collectable"
audio.PlayOneShot(collectedSound); //plays the sound assigned to collectedSound
collected++; //adds a count of +1 to the collected variable
if(collected == 14){
//Play Animation here like for example:
EndZone.animation.Play("Collectedall"); //Change AnimationName to the name of your animation.
}
Destroy (other.gameObject);}}}
and
using UnityEngine;
using System.Collections;
public class GemChecks : MonoBehaviour{
public int GemColour;
private void
if(Gems.ColourID == 0)}
(not sure what will happen after the if)
and i get this message with the second script
invalid token ‘if’ class,struct or interface member declaration.
(the same goes for the ==)
i’m not sure what is wrong so could somebody please tell me.