+1 vote

[EDIT: solved the issue by accessing player child node with a singleton setted in project settings > autoload (Global)
in global.gd:

var player_node = null

in player :

func _ready():
    Global.player_node = self

So you can access player child with :

Global.player_node.<child_name>.<whatever_you_want>

that way, even if the player is not fully loaded in the scene, you will not get null instance errors in _draw()]

Hello everybody !

I have a node that need a player child postition to draw some gui around it.

func _draw():
    #draw something

Problem is, the draw function seem to get called before everything else in the scene. So my player has not finished loading every children and the draw function is called anyway.

I search an efficient way of disabling the draw process (something like set_draw(false)).
Because for now it uses an if statement at each draw call which is not very optimized and stable...

I have signals set up to manage such a function.

Thanks for your time

in Engine by (82 points)
edited by

Please log in or register to answer this question.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.