#How to change scene?

3 messages · Page 1 of 1 (latest)

pearl apex
#

Heyya ! I am ashamed that I couldn't figure this on my own .... but ... how do I change a scene based on pressing a button?
For context, I am using C# for scripting on Godot 4.2.2 version.
I'm a bit confused as I've found tutorials showing multiple ways of doing that, but possibly they are deprecated.
I get this error :
"CS1061: 'SceneTree' does not contain a definition for 'ChangeScene' and no accessible extension method 'ChangeScene' accepting a first argument of type 'SceneTree' could be found (are you missing a using directive or an assembly reference?) D:[Godot Projects][Godot 4.2.2] Tutorial\main_menu.cs(19,13)"

steady echo
#

ChangeScene() is a 3.x method, in 4.x you are looking for either ChangeSceneToPacked() or ChangeSceneToFile()

sacred jacinthBOT
#

Online API Reference for SceneTree. You can also use the offline documentation by pressing F1 in Godot and searching for a class name.