mirror of
https://github.com/godotengine/godot-docs.git
synced 2026-01-04 14:11:02 +03:00
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:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user