Since you can have multiple Resources folders in your project, I’m wondering how Unity would know the difference between two assets that have the same relative path.
For example:
Assets/Folder A/Resources/Subfolder/file.txt
Assets/Folder B/Resources/Subfolder/file.txt
When I would use
Resources.Load<TextAsset>("Subfolder/file");
Could I know which file it will load? It doesn’t seem to be random since it’s loading the same file each time.
Could I force it to load the other file instead?
No, you can’t tell which one is which since they both get packed into a resource file in the end. The path is exactly the same. You can get both by using:
Resources.LoadAll<TextAsset>("Subfolder/file");
The returned order is arbitrary. You would have to distinguish them by the content they contain. However i don’t think it’s a good idea to have two different resources named the same. Be careful when using Resources, Unity can’t optimise anything since everything inside Resources folders will be included in a build, no matter if you use it or not.