From 6bc9b5b15cee1b942bb2db94229984ad3aa7569d Mon Sep 17 00:00:00 2001 From: br0kenpixel Date: Tue, 5 May 2026 11:11:07 +0200 Subject: [PATCH] simplify player transfor getter in zombie controller --- Assets/Scripts/ZombieController.cs | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/Assets/Scripts/ZombieController.cs b/Assets/Scripts/ZombieController.cs index 001cb2b..ef402a1 100644 --- a/Assets/Scripts/ZombieController.cs +++ b/Assets/Scripts/ZombieController.cs @@ -1,6 +1,6 @@ using UnityEngine; -[RequireComponent(typeof(Animator))] +[RequireComponent(typeof(Animator))] [RequireComponent(typeof(Rigidbody))] public class ZombieController : MonoBehaviour { @@ -31,12 +31,7 @@ public class ZombieController : MonoBehaviour { currentHealth = maxHealth; animator = GetComponent(); - - GameObject playerObject = GameObject.FindGameObjectWithTag("Player"); - if (playerObject != null) - player = playerObject.transform; - else - Debug.LogWarning("Zombie nenašiel hráča — skontroluj tag 'Player'"); + player = GameObject.FindGameObjectWithTag("Player").transform; } private void Update()