Hey guys!
I am wondering if I want to Load something from Resources on Runtime like a Prefab, does the Texture that is assigned to the prefab also have to be in the Resources Folder?
Thank you!
Hey guys!
I am wondering if I want to Load something from Resources on Runtime like a Prefab, does the Texture that is assigned to the prefab also have to be in the Resources Folder?
Thank you!
Only the prefab needs to be in the folder. You can also load any type of asset (Sprite, AnimationClip, whatever) in addition to prefabs (which are of the type GameObject).
For this reason, you may as well put all of your non-script assets inside the Resources folder so you can load them as needed. Note that you can organize your Resources folder however you like with sub directories.
// To load a sprite called "PlayerSprite" in /Resources/Sprites
Sprite mySprite = Resources.Load<Sprite>("Sprites/PlayerSprite");