All your resources have to be in a folder called Resources. The Resources folder can have sub folders as well, but will need foldername/ prefix to the filename. No extension is needed.
I can have:
resources/images
resources/models
resources/prefabs
and access them as Resources.Load(“images/image1”) ???
Wow! About 2 years ago I was struggling with file paths not matching between Editor and standalone app and finally figured out I can have multiple resource folders and then everything works. Since then I have been using
I’ll have to go give this a try because my way frustrated me. I simply thought Unity demanded it that way. I am quite surprised that this might work actually because, as I understand it, at build time Unity takes everything in the resources folder and dumps them into a single folder and creates an asset package from them. I was not aware that they drop folders into the asset folder… I will really have to go test this out! Thanks for the heads up!
hmm, this to be working… GREAT!!! thanks. but one thing, when i call the Instantiate function, it makes it so its called cube(clone) and this then screws up the script (its an inventory script, and it needs to be called cube (an example) the whole way through, any suggestions?)
cause above code does not check for clone at the end (which would be done through from.EndsWith(“(Clone)”)), it looks only if its present in the name which above straight replace does as well