Improve C# GD.Load() examples

* Use typed version of GD.Load()
* Use absolute paths (i.e., prefixed with "res://")
* Use "Path/To/" intermediate path values on abstract examples, to
  illustrate that files can live in various directories
* Use PascalCase on files that are not GDScript or GLSL
This commit is contained in:
Mark Wilson
2023-10-06 13:29:26 -04:00
parent fd94ebfaab
commit 147d2233c7
8 changed files with 38 additions and 29 deletions

View File

@@ -191,7 +191,7 @@ current scene and replace it with the requested one.
func _deferred_goto_scene(path):
# It is now safe to remove the current scene
# It is now safe to remove the current scene.
current_scene.free()
# Load the new scene.
@@ -224,11 +224,11 @@ current scene and replace it with the requested one.
public void DeferredGotoScene(string path)
{
// It is now safe to remove the current scene
// It is now safe to remove the current scene.
CurrentScene.Free();
// Load a new scene.
var nextScene = (PackedScene)GD.Load(path);
var nextScene = GD.Load<PackedScene>(path);
// Instance the new scene.
CurrentScene = nextScene.Instantiate();