'HealthBar.slider' 是一个“字段”,但需要一个“类型”?

时间:2020-12-22 13:27:46

标签: types field

我真的不知道为什么会发生这种情况。我尝试查找,但仍然找不到适用于我的情况的解决方案。为什么我会收到这些错误?我有另一个健康栏脚本,但我删除了它,因为它不起作用,所以我重新制作了它,现在我收到了这些错误。请帮忙

我使用的是 Unity 版本 2018.2.10 和 C# 语言

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class HealthBar : MonoBehaviour {


    public Slider slider;

    public void SetMaxHealth(int health)
    {
        slider maxValue = health;
        slider value = health;
    }

    public void SetHealth(int health)
    {
        slider value = health;
    }
}

0 个答案:

没有答案
相关问题