Make sure you use code tags when sharing code . You did it right the first time you posted, so make sure you do it every time!
I copied your code and formatted it, and ended up with this:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Moneda : MonoBehaviour {
public static int monedaCount = 0;
}
{
void Start()
{
Debug.Log; ("Hola Mundo");
Moneda.coinsCount++;
}
// Update is called once per frame
void Update()
{
void OnTriggerEnter(Collider playercollider)
{
Debug.Log; ("He tocado la moneda");
}
if (collider.Compare.Tag);
("Player");
{
OnDestroy(gameobject);
}
void OnDestroy() {
Moneda.coinsCount--;
}
if (Moneda.coinsCount <= 0);
{
Debug.log; "game over";
}
}
}
Unfortunately, this script is essentially nonsense. Based on this post and your other one, I’m guessing you’re just starting out in your development journey. That’s totally fine. But it is clear you don’t really understand the basics of how code works yet, and I think you really need to spend some time reading, watching videos, and running through tutorials before trying to write your own scripts. You’re essentially just throwing lines of code together now hoping they’ll do something, and that’s just not how code works.
Back up a good bit, slow things down, and focus on understanding the concepts of what you’re doing instead of trying to learn what specific words do what specific thing in Unity.
Edit: [mention|8JLFhDQSR/y9hqzDv/BDDw==] gave you some great advice in your first post . I strongly suggest you take his advice to heart and practice what he’s saying.