유니티 C# 플레이어 Hp바 간단 구현하기


유니티 C# 플레이어 Hp바 간단 구현하기

코드 작성 using UnityEngine; using UnityEngine.UI; public class Player : MonoBehaviour { public int health = 3; public Image[] healthImages; public void TakeDamage() //공격하기 { health -= 1; healthImages[health].gameObject.SetActive(false); Debug.Log("Player's health: " + health); } } 다른 쪽에서 플레이어 공격할때 Player player = new Player(); player.TakeDamage(); 유니티 기본 UI Slider를 사용하여 구현하기 using UnityEngine; usin..


원문링크 : 유니티 C# 플레이어 Hp바 간단 구현하기