Files
berry-dash-godot-remake/Scripts/SceneSwitcher.cs
T
2026-01-18 23:40:22 -07:00

24 lines
552 B
C#

using Godot;
public partial class SceneSwitcher : Button {
[Export]
public string ScenePath = ""; // Set this in the Inspector
public override void _Ready() {
Pressed += OnButtonPressed;
}
private void OnButtonPressed() {
if (string.IsNullOrEmpty(ScenePath)) {
GD.PrintErr("Scene path not set!");
return;
}
var error = GetTree().ChangeSceneToFile(ScenePath);
if (error != Error.Ok) {
GD.PrintErr("Failed to change scene: " + error);
}
}
}