- Home /
Resource.Load Issue
Hey guys,
I set-up a custom folder inside of the Resources folder and put this code in on my script:
GameObject.Find ("Dialogue_Prof_Image").GetComponent<Image> ().overrideSprite = (Sprite)Resources.Load ("/Resources/ProfPic/old_man_Profile.png");
The aim of this is so that in the future i can assign a profile picture to each NPC ingame and it will load for each dialogue conversation between the NPC/Player.
However, no image is loaded. I checked to ensure all folders were named correctly and they were. Any assistance would be appreciated, I've come back to using Unity since Unity3.1 so it's likely there's been a major syntax change im unaware of.
Answer by cstooch · Jul 11, 2017 at 04:20 PM
Been a while since I've had to do this, but a quick search, and I've got a couple things for you to try:
Make sure your Resources folder is in Assets folder.
From what I understand, the "/Assets/Resources/" part of the path is implied, so try this for your file location: "ProfPic/old_man_Profile.png"
The file extension is implied, too, so it's just: "ProfPic/old_man_Profile".