npc talk
This commit is contained in:
@@ -14,13 +14,19 @@ namespace Hallucinate.UI
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
mainCameraTransform = Camera.main.transform;
|
||||
canvasGroup.alpha = 0;
|
||||
gameObject.SetActive(false);
|
||||
if (canvasGroup != null) canvasGroup.alpha = 0;
|
||||
// gameObject.SetActive(false); // Bỏ dòng này để tránh tắt nhầm NPC gốc
|
||||
}
|
||||
|
||||
private void LateUpdate()
|
||||
{
|
||||
// Tìm Camera nếu chưa có (Tránh lỗi Null nếu Camera chưa spawn hoặc bị xóa)
|
||||
if (mainCameraTransform == null)
|
||||
{
|
||||
if (Camera.main != null) mainCameraTransform = Camera.main.transform;
|
||||
else return;
|
||||
}
|
||||
|
||||
// Billboard effect
|
||||
transform.LookAt(transform.position + mainCameraTransform.rotation * Vector3.forward, mainCameraTransform.rotation * Vector3.up);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user