I'm having a problem with change_scene_to_file in Godot 4. For some reason after the scene transition succeeded, I was automatically transported back the previous play state.
Here is the video of my problem : https://drive.google.com/file/d/1oC1mx1tqMEnfH9ovZAjP_d6DI60xODji/view?usp=sharing
I use the same code for change_scene
from inside the house to outside:
extends Area2D var entered = false func _on_body_entered(_body): entered = true func _on_body_exited(_body): entered = false func _process(_delta): if entered == true: if Input.get_action_strength("enter"): get_tree().change_scene_to_file("res://Levels/game_level.tscn") from outside to inside the house:
extends Area2D var entered = false func _on_body_entered(_body): entered = true func _on_body_exited(_body): entered = false func _process(_delta): if entered == true: if Input.get_action_strength("enter"): get_tree().change_scene_to_file("res://Levels/inside_house.tscn") If I go from inside_house to outside it works just fine, but the other way it starts to have this problem.
How do I solve this?