Код работал но сейчас юнити выдаёт ошибку
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class Score : MonoBehaviour
{
public int score;
public Text scoreDisplay;
public int coin;
public Text coinDisplay;
private void Update()
{
scoreDisplay.text = score.ToString();
coinDisplay.text = coin.ToString();
}
private void OnTriggerEnter2D(Collider2D other)
{
score++;
coin++;
Destroy(other.gameObject);
}
public void Reward()
{
coin += 10;
}
}
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class Player : MonoBehaviour {
public float speed;
public float increment;
public float maxY;
public float minY;
private Vector2 targetPos;
public int health;
public GameObject moveEffect;
public Animator camAnim;
public Text healthDisplay;
public GameObject spawner;
public GameObject restartDisplay;
public GameObject sound;
private void Update()
{
if (health <= 0) {
spawner.SetActive(false);
restartDisplay.SetActive(true);
Destroy(gameObject);
}
healthDisplay.text = health.ToString();