Closed David1Socha closed 1 year ago
I think we can just remove _target = GetNodeOrNull<Node2D>(targetPath);
from _EnterTree
, since now all places that need to read _target
have it set before.
I think we can just remove
_target = GetNodeOrNull<Node2D>(targetPath);
from_EnterTree
, since now all places that need to read_target
have it set before.
Sounds good, I added a commit removing that line.
Thanks!
Fixes a bug that can occur with Trail2D when AutoZIndex is enabled and the Trail2D is set to target a parent node. Under those conditions, ZIndex will always be set to 0 (and since
SetAsToplevel
is used in Trail2D it's effectively a global level 0 z-index) instead of the expected Z index of_target.ZIndex - 1
.Because the Trail2D has its
EnterTree()
function called before the parent has been added to the tree, the initial attempt to set_target
finds nothing and_target
is null. There is a later check in_Process
that attempts to set_target
, but that does not happen until after the auto z-index is set. This PR adds a search for_target
to theNotificationParented
handler.This issue does not happen with trail_2d.gd because in that file the setter for
target_path
is called whenNotificationParented
is received, and thetarget_path
setter updatestarget
. So I did not change anything with that file.