From 9a49173f337446fc2b4d8b3a63afa38803f48beb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alptu=C4=9F=20C=C4=B1r=C4=B1t?= Date: Mon, 11 Mar 2024 17:05:27 +0300 Subject: [PATCH] fix: simplify ResetEgoToSpawnPoint() function MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Alptuğ Cırıt --- Assets/AWSIM/Scripts/UI/HotkeyHandler.cs | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/Assets/AWSIM/Scripts/UI/HotkeyHandler.cs b/Assets/AWSIM/Scripts/UI/HotkeyHandler.cs index b78184a819..3755aedcc7 100644 --- a/Assets/AWSIM/Scripts/UI/HotkeyHandler.cs +++ b/Assets/AWSIM/Scripts/UI/HotkeyHandler.cs @@ -35,15 +35,14 @@ void Update() // If the ego transform reference is present, reset the ego to the initial position and rotation. public void ResetEgoToSpawnPoint() { - if (_egoTransform == null) + if (!_egoTransform) { Debug.LogWarning("Ego transform reference is missing. No ego to reset here!"); + return; } - else - { - _egoTransform.SetPositionAndRotation(_initialEgoPosition, _initialEgoRotation); - _egoRigidbody.Sleep(); - } + + _egoTransform.SetPositionAndRotation(_initialEgoPosition, _initialEgoRotation); + _egoRigidbody.Sleep(); } } } \ No newline at end of file