Hello everyone I have the error CS1525 and I can't find the problem despite several searches Code (CSharp): IEnumerator AnimationCaisseVert () { FondNoir.SetActive(true); ImagecaisseVerte.SetActive(true); yield return new WaitForSeconds(1.2f); openingVerte.SetTrigger("Go"); yield return new WaitForSeconds(1.2f); int rand = Random.Range(0, 100); if ( rand <= 50) { /// ExtraLife Extralife.SetActive(true); openingExtralife.SetTrigger("Go"); } if ( rand > 50) { /// gold Gold.SetActive(true); openingGold.SetTrigger("Go"); } }
The error should have more information and tell you the specific line. It would be helpful if you'd include that information here with your question.
But what line in the above code? It says so in the error. In the console you can even click on the error and it brings you to the line of code. I have a feeling it is in code other than what you have posted, because I don't see it.
No, it's the right line and that's why I'm wondering because I don't see the error either. Assets/Scripts/OpeningCaisse.cs(199,33): error CS1525: Unexpected symbol `(', expecting `,', `;', or `=' Code (CSharp): using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; public class OpeningCaisse : MonoBehaviour { // Use this for initialization private GameObject[] characterObjectList; private GameObject Manager; public int index; public Text TextVert; public Text TextBleu; public Text TextViolet; public Text TextGold; public int NBCaisseVert; public int NBCaisseBleu; public int NBCaisseViolet; public int NBCaisseGold; public int NBCaisseGeneral; /// les animation public Animator openingVerte; public Animator openingGoldX2; public Animator openingExtralife; public Animator openingGold; /// les games object pour l'animation public GameObject FondNoir; public GameObject ImagecaisseVerte; public GameObject ImagecaisseBleu; public GameObject Extralife; public GameObject GoldX2; public GameObject Gold; private void Awake () { Manager = GameObject.Find("GameManager").gameObject; /////////////////// mise a jour des valeurs NBCaisseGeneral = PlayerPrefs.GetInt("CaisseGeneral"); NBCaisseVert = PlayerPrefs.GetInt("CaisseVert"); NBCaisseBleu = PlayerPrefs.GetInt("CaisseBleu"); NBCaisseViolet = PlayerPrefs.GetInt("CaisseViolet"); NBCaisseGold = PlayerPrefs.GetInt("CaisseGold"); ////// mise à jour des text TextVert.text = NBCaisseVert + " "; TextBleu.text = NBCaisseBleu + " "; TextViolet.text = NBCaisseViolet + " "; TextGold.text = NBCaisseGold + " "; ///// desactive tout pour l'Animation ImagecaisseVerte.SetActive(false); ImagecaisseBleu.SetActive(false); FondNoir.SetActive(false); Extralife.SetActive(false); GoldX2.SetActive(false); Gold.SetActive(false); index = 0; characterObjectList = new GameObject[transform.childCount]; for(int i = 0; i < transform.childCount; i++) { characterObjectList[i] = transform.GetChild(i).gameObject; } foreach (GameObject go in characterObjectList) go.SetActive(false); if(characterObjectList[index]) characterObjectList[index].SetActive(true); } //////////////////////////Boutons des caisses //////////// public void CaisseVert() { if ( index != 0 ) { characterObjectList[index].SetActive(false); index = 0; characterObjectList[index].SetActive(true); } } public void CaisseBleu() { if ( index != 1 ) { characterObjectList[index].SetActive(false); index = 1; characterObjectList[index].SetActive(true); } } public void CaisseViolet() { if ( index != 2 ) { characterObjectList[index].SetActive(false); index = 2; characterObjectList[index].SetActive(true); } } public void CaisseGold() { if ( index != 3 ) { characterObjectList[index].SetActive(false); index = 3; characterObjectList[index].SetActive(true); } } //////////////////// OUVERTURE DE LA CAISSE ////////////////// public void Ouverture() { if ( index == 0) { if ( NBCaisseVert > 0 ) { Debug.Log("la caisse verte à bien été ouverte"); NBCaisseVert -= 1; TextVert.text = NBCaisseVert + " "; PlayerPrefs.SetInt("CaisseVert", NBCaisseVert); NBCaisseGeneral -= 1; PlayerPrefs.SetInt("CaisseGeneral", NBCaisseGeneral); ///// la caisse fais gagner tant de gold puis enregistre le nombre de gold Manager.GetComponent<GameManager>().Gold +=1000000; PlayerPrefs.SetInt("Gold", Manager.GetComponent<GameManager>().Gold); StartCoroutine(AnimationCaisseVert()); } } if ( index == 1) { if ( NBCaisseBleu > 0 ) { Debug.Log("la caisse bleu à bien été ouverte"); NBCaisseBleu -= 1; TextBleu.text = NBCaisseBleu + " "; PlayerPrefs.SetInt("CaisseBleu", NBCaisseBleu); NBCaisseGeneral -= 1; PlayerPrefs.SetInt("CaisseGeneral", NBCaisseGeneral); ///// la caisse fais gagner tant de gold puis enregistre le nombre de gold Manager.GetComponent<GameManager>().Gold += 1000000; PlayerPrefs.SetInt("Gold", Manager.GetComponent<GameManager>().Gold); } } if ( index == 2) { if ( NBCaisseViolet > 0 ) { Debug.Log("la caisse violet à bien été ouverte"); NBCaisseViolet -=1 ; TextViolet.text = NBCaisseViolet + " "; PlayerPrefs.SetInt("CaisseViolet", NBCaisseViolet); NBCaisseGeneral -= 1; PlayerPrefs.SetInt("CaisseGeneral", NBCaisseGeneral); ///// la caisse fais gagner tant de gold puis enregistre le nombre de gold Manager.GetComponent<GameManager>().Gold += 1000000; PlayerPrefs.SetInt("Gold", Manager.GetComponent<GameManager>().Gold); } } if ( index == 3) { if ( NBCaisseGold > 0 ) { Debug.Log("la caisse gold à bien été ouverte"); NBCaisseGold -= 1; TextGold.text = NBCaisseGold + " "; PlayerPrefs.SetInt("CaisseGold", NBCaisseGold); NBCaisseGeneral -= 1; PlayerPrefs.SetInt("CaisseGeneral", NBCaisseGeneral); ///// la caisse fais gagner tant de gold puis enregistre le nombre de gold Manager.GetComponent<GameManager>().Gold += 1001000000; PlayerPrefs.SetInt("Gold", Manager.GetComponent<GameManager>().Gold); } } /// toute les Animations IEnumerator AnimationCaisseVert () { FondNoir.SetActive(true); ImagecaisseVerte.SetActive(true); yield return new WaitForSeconds(1.2f); openingVerte.SetTrigger("Go"); yield return new WaitForSeconds(1.2f); int rand = Random.Range(0, 100); if ( rand <= 50) { /// ExtraLife Extralife.SetActive(true); openingExtralife.SetTrigger("Go"); } if ( rand > 50) { /// gold Gold.SetActive(true); openingGold.SetTrigger("Go"); } } }