Browse Source

Merge pull request #20600 from exts/new_generic_methods

Mono: Added generic methods for PackedScene & ResourceLoader
Ignacio Etcheverry 7 years ago
parent
commit
b911165679

+ 5 - 0
modules/mono/glue/cs_files/GD.cs

@@ -64,6 +64,11 @@ namespace Godot
             return ResourceLoader.Load(path);
             return ResourceLoader.Load(path);
         }
         }
 
 
+        public static T Load<T>(string path) where T : Godot.Resource
+        {
+            return (T) ResourceLoader.Load(path);
+        }
+
         public static void Print(params object[] what)
         public static void Print(params object[] what)
         {
         {
             NativeCalls.godot_icall_Godot_print(what);
             NativeCalls.godot_icall_Godot_print(what);

+ 10 - 0
modules/mono/glue/cs_files/ResourceLoaderExtensions.cs

@@ -0,0 +1,10 @@
+namespace Godot
+{
+    public static partial class ResourceLoader
+    {
+        public static T Load<T>(string path) where T : Godot.Resource
+        {
+            return (T) Load(path);
+        }
+    }
+}