Tacker
@Tacker

Как решить проблему?

Код работал но сейчас юнити выдаёт ошибку
624b42d7301c7134047198.png
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();
  • Вопрос задан
  • 113 просмотров
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы