- Home /
Loading a sprite from resource folder
Hi all, from learning from below video i got stuck while adding sprites (at 15:30): https://www.youtube.com/watch?v=OxObASeB05I When i try to include sprites (using set get and Resources.load) sprite won't show up. While debugging it show null. here's the code: alt text
Answer by Reynarz · Aug 01, 2017 at 04:54 PM
Do you have a Resource folder inside Assets folder with a folder called Sprites? And the "slug" string parameter get an avaliable image name?
Sorry, so much folders xd
Ah, after 7 hours of tinkering found slug parameters did not had 's' at the end.
Answer by FortisVenaliter · Aug 01, 2017 at 03:46 PM
Yes, this is because a file can't be a sprite. It can be an image, which can contain one or more sprites.
If I recall correctly, you need to use Resources.LoadAll to get all sprites for that image, then filter out the one you want from the returned collection.
$$anonymous$$aybe I haven't understood the video completely but he did the same thing and he got it. (Im a beginner to unity)
Your answer
![](https://koobas.hobune.stream/wayback/20220612131701im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Get/set vector 3 causing problems 0 Answers
Public variable hidden in the inspector 2 Answers
Resources.Load sprite returning null (4.3) 3 Answers
Instead of "new" for accessing properties? 1 Answer
Getter/Setter throwing missing reference on scene change 0 Answers