Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

Starting, error CS1003: Syntax error, ',' expected

Discussion in 'Getting Started' started by tommy1908_04, May 1, 2020.

  1. tommy1908_04

    tommy1908_04

    Joined:
    May 1, 2020
    Posts:
    3
    I`m starting in this word following a tutorial and some resourses to learn, and follow exactly and this appeard "
    Assets\Scrips\coin.cs(7,31): error CS1003: Syntax error, ',' expected"

    and this is my script
    using System.Collections;
    using System.Collections.Generic;
    using UnityEngine;

    public class coin : MonoBehaviour {

    public static int coinscount : 0;


    // Start is called before the first frame update
    void Start() {
    //Debug.Log ("Moneda Creada");
    coin.coinscount++;
    }

    // Update is called once per frame
    void Update() {

    }

    void OnTriggerEnter(Collider platerCollider) {
    if (collider.compareTag("player")) {
    Destroy (gameObject);
    }

    }



    void OnDestroy(){
    coin.coinsCount--;

    if (coin.coinsCount <= 0) {
    Debug.Log("El juego ha TERMINADO GANASTE!!!");

    }
    }
    }





    also it didn`t complete by him self like the tutorial, any suggestion is accepted, thank`s!
     
  2. Ryiah

    Ryiah

    Joined:
    Oct 11, 2012
    Posts:
    20,189
    On line 7 replace
    public static int coinscount : 0;
    with
    public static int coinscount = 0;
     
  3. tommy1908_04

    tommy1908_04

    Joined:
    May 1, 2020
    Posts:
    3
    it works but give me other errors :c
     
  4. tommy1908_04

    tommy1908_04

    Joined:
    May 1, 2020
    Posts:
    3
    thank´s