Browse Source

Update C# code for Scripting (continued) / Signals to use GD.Load<T>

Kelly Thomas 6 years ago
parent
commit
160bdf2a4e

+ 1 - 1
getting_started/step_by_step/scripting_continued.rst

@@ -349,7 +349,7 @@ first one is to load the scene from your hard drive:
 
  .. code-tab:: csharp
 
-    var scene = (PackedScene)ResourceLoader.Load("res://myscene.tscn"); // Will load when the script is instanced.
+    var scene = GD.Load<PackedScene>("res://myscene.tscn"); // Will load when the script is instanced.
 
 
 Preloading it can be more convenient, as it happens at parse

+ 1 - 1
getting_started/step_by_step/signals.rst

@@ -270,7 +270,7 @@ Here is the code for the player using signals to emit the bullet:
         [Signal]
         delegate void Shoot(PackedScene bullet, Vector2 direction, Vector2 location);
 
-        PackedScene _bullet = (PackedScene)GD.Load("res://Bullet.tscn");
+        PackedScene _bullet = GD.Load<PackedScene>("res://Bullet.tscn");
 
         public override void _Input(InputEvent event)
         {