What is the difference between using ResourceLoader.Load<PackedScene> and GD.Load<PackedScene>?

What is the difference between using this two in C#?

var scene = ResourceLoader.Load<PackedScene>("res://MyScene.tscn").Instantiate();
AddChild(scene);

var scene = GD.Load<PackedScene>("res://MyScene.tscn");
var instance = scene.Instantiate();
AddChild(instance);

From visual studio, mouse over a function to see its summary. here are the summaries for ResourceLoader.Load and GD.Load. at the end of the GD.Load summary, it says GD.Load is a simplified version of ResourceLoader.Load.

var scene = ResourceLoader.Load<PackedScene>("res://MyScene.tscn").Instantiate();
		// Summary:
		//     Loads a resource at the given path, caching the result for further access. The
		//     registered Godot.ResourceFormatLoader instances are queried sequentially to find
		//     the first one which can handle the file's extension, and then attempt loading.
		//     If loading fails, the remaining ResourceFormatLoaders are also attempted. An
		//     optional typeHint can be used to further specify the Godot.Resource type that
		//     should be handled by the Godot.ResourceFormatLoader. Anything that inherits from
		//     Godot.Resource can be used as a type hint, for example Godot.Image. The cacheMode
		//     property defines whether and how the cache should be used or updated when loading
		//     the resource. See Godot.ResourceLoader.CacheMode for details. Returns an empty
		//     resource if no Godot.ResourceFormatLoader could handle the file.
var scene = GD.Load<PackedScene>("res://MyScene.tscn");
		// Summary:
		//     Loads a resource from the filesystem located at path. The resource is loaded
		//     on the method call (unless it's referenced already elsewhere, e.g. in another
		//     script or in the scene), which might cause slight delay, especially when loading
		//     scenes. To avoid unnecessary delays when loading something multiple times, either
		//     store the resource in a variable. Note: Resource paths can be obtained by right-clicking
		//     on a resource in the FileSystem dock and choosing "Copy Path" or by dragging
		//     the file from the FileSystem dock into the script. Important: The path must be
		//     absolute, a local path will just return null. This method is a simplified version
		//     of Godot.ResourceLoader.Load(System.String,System.String,Godot.ResourceLoader.CacheMode),
		//     which can be used for more advanced scenarios.

1 Like