loading image into GUILayout using Resources.Load

Hi All,

I'm trying to load jpg file to be shown on a button via the command in C#

GUILayout.Button(Resources.Load(nameOfImageFileAsString));

But I get compile time error since Resources.Load(string) return object and GUILayout.Button excpects Texture object...

Can u help me please?

Thank u in advance

Eyal

You have to cast it to the required type, e.g.:

(Texture2D)Resources.Load(string);