Godot 3 load/preload functions in C#

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Antonb
:warning: Old Version Published before Godot 3 was released.

Hi,
how can I access load() and preload() functions in Godot 3 C#? I can’t find them in any class.

Thanks.

:bust_in_silhouette: Reply From: Zylann

There is no load and preload keywords in C#, you have to use the ResourceLoader class instead which does the same thing:

var texture = ResourceLoader.Load("res://icon.png") as Texture;

Also there is no equivalent of preload because that one in particular is specific to GDScript (Godot is able to load resources when the script is loaded, which isn’t possible with C#).

Thanks for the answer. Can you tell me where you got this info? Is there some resource I can take a look at? Because I googled quite a lot before asking and didn’t find anything.

Antonb | 2017-12-06 06:29

I got the info by seeing some examples here Introducing C# in Godot, and on Discord by chatting with devs. Infos about C# should be added to official docs but at the moment I don’t see them.

Zylann | 2017-12-06 19:43