From 9f4cda0e6dac9c5628f0f6c14c23b4bd81b4eb44 Mon Sep 17 00:00:00 2001 From: kziolkowski Date: Thu, 4 Dec 2025 22:22:40 +0100 Subject: [PATCH] :recycle: Replaced _ready mit _entertree (while deferring) --- scripts/CSharp/Common/Animation/VesnaAnimations.cs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/scripts/CSharp/Common/Animation/VesnaAnimations.cs b/scripts/CSharp/Common/Animation/VesnaAnimations.cs index 372cf9f..f883252 100644 --- a/scripts/CSharp/Common/Animation/VesnaAnimations.cs +++ b/scripts/CSharp/Common/Animation/VesnaAnimations.cs @@ -19,7 +19,13 @@ public partial class VesnaAnimations : Node /// [Signal] public delegate void LookDirectionEventHandler(Vector2 direction); - public override void _Ready() + public override void _EnterTree() + { + // calling with a 1-frame delay to avoid race conditions. + CallDeferred(nameof(SetupSubscriptions)); + } + + private void SetupSubscriptions() { InventoryManager.Instance.playerInventory.InventoryContentsChanged += HandleNewItemInInventory; }