diff options
author | Ignacio Etcheverry <neikeq@users.noreply.github.com> | 2018-08-04 05:22:38 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-08-04 05:22:38 +0200 |
commit | b911165679f906dbb4a18ff5eb0b9ac27c5485dc (patch) | |
tree | 19f4892e0dc3dc7da526cf75018c90fbb3d40898 | |
parent | 6c569c90b666c7fb773eca3948fc76ba7a160a27 (diff) | |
parent | cdb4ae471b6aeb0f1afacae3dd42774660d8f133 (diff) |
Merge pull request #20600 from exts/new_generic_methods
Mono: Added generic methods for PackedScene & ResourceLoader
-rw-r--r-- | modules/mono/glue/cs_files/GD.cs | 5 | ||||
-rw-r--r-- | modules/mono/glue/cs_files/ResourceLoaderExtensions.cs | 10 |
2 files changed, 15 insertions, 0 deletions
diff --git a/modules/mono/glue/cs_files/GD.cs b/modules/mono/glue/cs_files/GD.cs index e2457ff98b..43de9156f2 100644 --- a/modules/mono/glue/cs_files/GD.cs +++ b/modules/mono/glue/cs_files/GD.cs @@ -64,6 +64,11 @@ namespace Godot 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) { NativeCalls.godot_icall_Godot_print(what); diff --git a/modules/mono/glue/cs_files/ResourceLoaderExtensions.cs b/modules/mono/glue/cs_files/ResourceLoaderExtensions.cs new file mode 100644 index 0000000000..ceecc589e6 --- /dev/null +++ b/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); + } + } +} |