0 votes

[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

asked May 2 in Engine by leo-pnt (42 points)
edited May 2 by leo-pnt

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.