- Home /
Question by
m3-lawes · Feb 20, 2015 at 12:30 PM ·
errorunexpectedsymbolcs1525
Error unexpected symbol 'internal' What is wrong with this?
public class BatteryCollect : MonoBehaviour {
public int charge = 0;
public Texture2D charge1tex;
public Texture2D charge2tex;
public Texture2D charge3tex;
public Texture2D charge4tex;
public Texture2D charge0tex;
// initialise GUI texture to false (don't display it)
void Start(){
guiTexture.enabled = false;
charge = 0;
}
//update function checks status of charge variable
//which is increased via an external script
//each time the player collides (collects) with a battery
void Update () {
//first battery collected
//assign the first texture image to guiTexture
//and enable (display) texture
if(charge == 1){
guiTexture.texture = charge1tex;
guiTexture.enabled = true;
}
// display subsequent textures to indicate power collected
else if(charge == 2){
guiTexture.texture = charge2tex;
}
else if(charge == 3){
guiTexture.texture = charge3tex;
}
else if(charge == 4){
guiTexture.texture = charge4tex;
}
else if(charge == 0){
guiTexture.texture = charge0tex;
}
}
public void setCharge(){
// updates the charge variable via a message
// from the PlayerCollions script
charge = charge + 1 ;
}
}
Comment
Is there more info on the error? The code does look right.
You are not using the keyword "internal" here. Are you sure this is where the error is ?
On line
public void setCharge(){
there are actually some garbage characters after '{'. Just remove them.