Suppose I’ve these two courses
class_name A
func _input(occasion: InputEvent) -> void:
if occasion is InputEventMouseButton and occasion.is_pressed() and _get_global_variable() != 'B ':
_set_global_variable('A')
class_name B
extends RigidBody3D
func _input_event(digital camera: Camera3D, occasion: InputEvent, event_position: Vector3, regular: Vector3, shape_idx: int) -> void:
# this piece of code is meant to occur if we clicked on this collider
if occasion is InputEventMouseButton and occasion.is_pressed() and _get_global_variable() != 'A':
_set_global_variable('B')
There are B that’s checking if we click on in your colider wherein case, we set up one thing in ‘B’. If we don’t click on in your colider, class A should set up the variable in ‘A’.
These occasions have to be mutually unique. That’s, if I click on B, then I do not need him to do his factor and if I didn’t click on on B, he ought to do his factor.
However the issue now could be that A._input
It’s at all times referred to as first, no matter the place we click on. So, if I don’t click on on, then we execute A._input
and B._input_event
It’s not referred to as. But when I click on on B, then run A._input
first and B._input_event
It’s referred to as however _get_global_variable()
He has already returned ‘to’.
How can I decide the order wherein the Godot engine should execute these occasions?