[C#] Loading sprite problem

So this is the error:

error CS0266: Cannot implicitly convert type `UnityEngine.Object' to `UnityEngine.Sprite'. An explicit conversion exists (are you missing a cast?)

And this is the line of code that causes the error:

Sprite banana_sprite = Resources.Load("Sprites/banana_sprite", typeof(Sprite));

What am i doing wrong? :frowning:

You need to do a typecast anytime you use Resources.Load.

Sprite banana_sprite = (Sprite)Resources.Load("Sprites/banana_sprite", typeof(Sprite));

Or, better yet, use the Generic version of the function:

Sprite banana_sprite = Resources.Load<Sprite>("Sprites/banana_sprite");