Add a way to get the global z_index of a node. #11599
vvvvvvitor
started this conversation in
2D
Replies: 2 comments
-
|
Seconded, this would be really useful and while it can be done in gdscript, this feels like a function that could be handled better by making it core (aka making the looping through parents a little faster) |
Beta Was this translation helpful? Give feedback.
0 replies
-
|
For now though, the best solution is to use this type of function (also adapted from the code originally found in this post here): static func get_absolute_z_index(target:CanvasItem) -> int:
var z_index:int = 0
while target and target is CanvasItem:
z_index += target.z_index
if not target.z_as_relative:
break
target = target.get_parent()
return z_index |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
As the title says, there isn't much to it.
Beta Was this translation helpful? Give feedback.
All reactions