From d58496a08bb1edfa9e5687bcf9ff54eac04644e8 Mon Sep 17 00:00:00 2001 From: Adam Salah Date: Tue, 29 Jul 2025 17:34:44 -0400 Subject: [PATCH] optimized projectile initialization in Root.cs --- Assets/Scripts/Root.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Assets/Scripts/Root.cs b/Assets/Scripts/Root.cs index 1ad27bc..5a6661d 100644 --- a/Assets/Scripts/Root.cs +++ b/Assets/Scripts/Root.cs @@ -35,10 +35,10 @@ public class Root : MonoBehaviour Vector3 spawnPos = (_projectileSpawn == null) ? _rigidbodyAlly.position : _projectileSpawn.position; GameObject _newArrow = Instantiate(_projectile, spawnPos, Quaternion.identity); - - //Warning : the Speed of the arrow is equal to the speed of this unit, if this unit need to move, use an other variable ! - _newArrow.GetComponent().Damage = _entity.AttackDamage; - _newArrow.GetComponent().Origin = _entity; + + var projectile = _newArrow.GetComponent(); + projectile.Damage = _entity.AttackDamage; + projectile.Origin = _entity; } public void PlaySound(string soundName)