Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FindChildren not finding nested children #75446

Closed
hawkerm opened this issue Mar 29, 2023 · 0 comments · Fixed by #75459
Closed

FindChildren not finding nested children #75446

hawkerm opened this issue Mar 29, 2023 · 0 comments · Fixed by #75459

Comments

@hawkerm
Copy link

hawkerm commented Mar 29, 2023

Godot version

4.0.1-stable_mono_win64

System information

Windows 10 19044

Issue description

I'm writing a C# script and trying to use FindChildren in my _Ready method.

My scene is like this with a root node with the script attached:

image

Calling FindChildren("face_*") is returning an empty array where I instead expect it to return a collection of the 6 nodes under cube_rounded.

If I call FindChild("face_*") instead it properly returns the face_front first node at the top of the tree, so the singular child function is working, but not the collection one.

FindChildren("Pivot") does find its immediate child, so it looks like maybe the recursive property is being ignored? Explicitly setting it to true changes nothing.

Steps to reproduce

  1. Install C# version of Godot
  2. Setup a 3D scene of nodes (any type) with hierarchy:
  • RigidBody3D (names not important here)
    • Pivot
      • cube_rounded
        • face_front
        • face_left
        • face_right
        • face_back
        • face_top
        • face_bottom
  1. Create a new C# script on the root node inheriting from Node3D
  2. Add var test = FindChildren("face_*"); in the _Ready() method
  3. set a breakpoint in Visual Studio and debug the project

See after executing the line that test is an empty array instead of the 6 expected nodes.

Repros in 4.0.0-stable as well (checked for new version and tried on 4.0.1 when I saw it had released, same issue).

Minimal reproduction project

Minimal project with same structure above of just Node3D objects:

FindChildrenRepro.zip

Setup to output in Console:

--- Debugging process started ---
Godot Engine v4.0.1.stable.mono.official.cacf49999 - https://godotengine.org
Vulkan API 1.3.205 - Forward Mobile - Using Vulkan Device #0: NVIDIA - NVIDIA GeForce GTX 1080
 
Children Count: 0 expect 6
Can find child instead: True

Should see Children Count: 6 expect 6 instead.

Included the call to FindChild which shows the exact same pattern working to find a child there, but the aggregate call with FindChildren fails.

@hawkerm hawkerm changed the title FindChildren not finding deeper children FindChildren not finding nested children Mar 29, 2023
@kleonc kleonc added this to the 4.1 milestone Mar 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants