If I load a resource, say a Material using Resources.Load() - does that Material's dependencies, such as its normal map texure, get loaded automatically? Or do I also have to manually do a Resources.Load() on the texture used by that loaded Material. And if so, does the loading order matter?
Also, related (this isn't really a separate question): If I'm using Resources.Load() then all loaded assets need to be duplicated into that Resources folder - right?
I mean I've read the docs on Resources.LoadAssetAtPath() but it says it only works in the Editor. So that means I have to use Resources.Load() and that if I have my project organized so all my Materials are in /Materials/ folder and textures in /Images/ folder then that means if I want to load them at runtime, then I have to make a duplicate of them into the Resources folder too? Is that right? Am I crazy in my thinking or is that a bit goofy since I'd now have to keep the 2 materials and 2 images in sync throughout my project folder?
Thanks for any clarification on Resources and Resource dependencies.
A build (for WebPlayer, EXE, etc.) is composed of all Resources, all Scenes that are listed in the build settings, and all their dependencies.
When you "load" a resources, all you are doing is finding the reference to it given its path. Similar, if Level0 has a Foo in the hierarchy and that Foo has a script variable set to a Gumby prefab and that Gumby has a renderer that uses material Baz and that Baz material uses the Jello texture, all these assets of the project are included in the build.
Resources are just the same, except they (and all their dependencies) are automatically included in the build (actually along with Level 0 by default).
Personally, I would prefer this:
As you can see, there is no way Unity can work out that DogSkin1, DogSkin2, etc. materials need to be included, those are "hidden dependencies", and hence you'd have to use resources. Whereas in the former code, it only needs to include those materials which you drag to the availableDogSkins array, and it knows those explicitly from your hierarchy.
And yes, it's goofy and crazy thinking to duplicate assets unnecessarily!