[solved] Singleton - How to access child notes?

TefloTeflo Posts: 5Member
edited May 2017 in Programming

Hey there!

So I have a whole scene in my autoload list, but it seems I can't access any of the child nodes of it. get_node('root/[singleton]/[child]') returns Nil.
How can I achieve this?

background:
I have a viewport buffer where I store a generated noise texture. I want to share this texture globally, so I only have to generate it once per frame (it's rather calculation heavy). Singleton seemed like the obvious choice here, but maybe I need another setup?

Thanks for your help!

Tagged:

Tags :

Answers

  • TefloTeflo Posts: 5Member
    edited May 2017 Answer ✓

    Ok I got it working!

    Problem was I set some parameters programmatically in said noise shader, and because I used 'tool' it did that already in the editor. When I saved the scene, this parameter was saved too, but couldn't be loaded, so it crashed.
    That caused that it never loaded the scene, so of course I couldn't access the children nodes.

    I deleted some lines in the scene file and got rid of the 'tool' term in the script. I can't see the shader in the editor that way, but at least it works.

Sign In or Register to comment.