I'm writing a script with a _draw() function attached to the root node (which is a referenceRect), and have an instance of this scene in my main scene. When I play just the uninstanced scene it draws as expected, but when displaying the main scene with the instanced scene as a child, nothing is drawn, although the _draw() function is executed. (debugged using print()). I checked the documentation but it says nothing about this. Am I doing something wrong?
Code for reference:
extends ReferenceRect
# class member variables go here, for example:
# var a = 2
# var b = "textvar"
var boxPos;
var boxSize;
var font;
func _ready():
# Called when the node is added to the scene for the first time.
# Initialization here
font = get_font("mainFont");
print("A".ord_at(0));
#font.draw_char(self,Vector2(10.0,10.0),"A".ord_at(0));
func _process(delta):
# # Called every frame. Delta is time since last frame.
# # Update game logic here.
# pass
self.update();
func _draw():
boxPos = self.get_global_position();
boxSize = self.get_size();
draw_rect(Rect2(boxPos,boxSize),Color(0,0,0,0.5),true);
draw_string(font,boxPos,"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA");
Also, as a side note, is there a way to pass delta to the draw function, or will it automatically inherit it since update() is being called from the _process function?