- Home /
PLEASE HELP ME!!!!! error CS1525
giving this error in script! talking about that private does not exist. this is the line of this error:
private void SetFeedBackAlpha(float alpha){ Color currentAlpha = feedBackSlender.material.color; currentAlpha.a = alpha;
feedBackSlender.material.color = currentAlpha;
private one at the beginning are talking about that does not exist, and alpha within the parenthesis also does not exist
Complete Script:
using UnityEngine; using System.Collections;
public class Lanterna : MonoBehaviour {
public Light spotLightFL;
public Animation playerAnimation;
public float speedRun;
private Ray rayToInteract;
private RaycastHit hitInteract;
public float rangeInteract;
public Renderer feedBackSlender;
public float scare = 0;
public float recoverScare;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
if(Input.GetMouseButtonDown(1) || Input.GetKeyDown(KeyCode.F)){
spotLightFL.enabled = !spotLightFL.enabled;
}
if(Input.GetAxis("Horizontal") != 0 || Input.GetAxis("Vertical") != 0){
playerAnimation.CrossFade(playerAnimation.clip.name);
}
else{
playerAnimation.Stop();
}
if(Input.GetKey(KeyCode.LeftShift))
GetComponent<CharacterMotor>().inputMoveDirection *= speedRun;
if(Input.GetMouseButtonDown(0)){
rayToInteract = Camera.main.ScreenPointToRay(new Vector3(Screen.width/2, Screen.height/2, 0));
if(Physics.Raycast(rayToInteract, out hitInteract, rangeInteract)){
if(hitInteract.collider.tag == "InteractObject"){
hitInteract.collider.GetComponent<ObjetoColetavel>().Interact();
}
}
}
if(scare > 0){
scare -= recoverScare;
if(scare < 0)
scare = 0;
}
SetFeedBackAlpha(scare);
if(scare >= 1){
Die();
}
private void SetFeedBackAlpha(float alpha){
Color currentAlpha = feedBackSlender.material.color;
currentAlpha.a = alpha;
feedBackSlender.material.color = currentAlpha;
}
private void Die(){
Debug.Log("Eu Morri");
}
}
please help me, I need to finish my horror game!!!!!!!!!!!!!!!
Answer by Bunny83 · Jul 30, 2013 at 11:04 PM
You simply miss a closing curly bracket before your function. If you look at the lines 53-56 you'll see that there is at least one bracket missing that would close the function Update.
A proper indent style might prevent such mistakes in the future ...