when I use the editor to create an area node and attaching this script, the onareainputevent is called properly:
var rectangle_shape = BoxShape.new()
rectangle_shape.extents = Vector3(500, 500, 2)
var collision_shape = CollisionShape.new()
collision_shape.shape = rectangle_shape
func _on_area_input_event( camera, event, click_pos, click_normal, shape_idx ):
pass # replace with function body
When I create the same node with the same translation etc from code by calling
var test = preload("res://test.gd")
var newTest = test.new()
# setting translation etc
The function is not called.
When viewing the live tree in the remote inspector I can't see any difference between the nodes.
Can anyone help me to get this node working when created from code?