#Cant Understand why I can't switch between scenes with a reusable 3d area

6 messages · Page 1 of 1 (latest)

merry scaffold
#

Im doing a 3D rpg style game and I want the player to enter a room switching between scenes.
I have two scenes, the outdoors and the room.
For switch, there is a scene with a simple 3dArea and a "@export var scenetochange: PackedScene" where I put the scene where the player goes from the Inspector and is a copy of that in the outdoors and the room.
The player can go one way, but when tries to go again the var scenetochange is not set.
Im doing something wrong with the change_ scene or maybe i am wrong doing the reusable scene?
The code for the area is this:

extends Area3D

@export var scenetochange: PackedScene
@export var active: bool = true

func _on_body_entered(body):
print("trigerChangeScene")
print(scenetochange.resource_path)
if body.is_in_group("player"):
if scenetochange && active:
get_tree().change_scene_to_packed(scenetochange)

hollow crane
#

could it be, that the room trigger has a different value in the new scene ? I assume the room trigger is an inherited scene.

merry scaffold
#

The room has the outdoors.tscn in the inspector

#

To come back

#

I think its something the the scene change, when loads the new scene the variable "scenetochange" is not set

merry scaffold
#

OMG, closed and opened the proyect and corrupted all my scenes with the trigger, I think godot dont like the "@export packedScene"