diff options
author | exts <lamonteh2@gmail.com> | 2018-07-30 06:35:48 -0500 |
---|---|---|
committer | exts <lamonteh2@gmail.com> | 2018-08-03 13:40:42 -0500 |
commit | cdb4ae471b6aeb0f1afacae3dd42774660d8f133 (patch) | |
tree | 74d8430797c45e9fbab1629a0a277a2fb8f7b18b /modules/mono | |
parent | 317dee95de84f3dca47b5ecc386975d6e37a9702 (diff) |
Added generic method for ResourceLoader: Load<T>()
Diffstat (limited to 'modules/mono')
-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); + } + } +} |