- Home /
Question is off-topic or not relevant
feature request: detect resource filename collisions at compile-time
Using unity 5.4.1, it's cool to have multiple "Resources" folders.
eg,
foo/Resources/foo.txt
bar/Resources/bar.txt
and if you do Resources.load("bar"), it works, yay!
however, if there's two resource files w/ the same name, like this:
foo/Resources/blah.txt
bar/Resources/blah.txt
then Resources.Load() will choose one of them without any warns or errors.
imo, this situation should be a compile-time error.
I made a script that can help with this:
Answer by JustAnotherDude · May 09, 2017 at 10:04 PM
This is not a question, post it on https://feedback.unity3d.com/
Answer by Bunny83 · May 09, 2017 at 10:07 PM
I agree that this can cause some confusion. However i think you still should be able to load both resources with Resources.LoadAll. Resources are not files but just assets. The name of the asset is just another datafield. Like in most databases you can have multiple entries with the same data (unless the column is set to be unique / is a primary key).
Though if you want to make a feature request you should post it on feedback
A month ago I create a lot of test of Resources class.
If we load assets with method Resources.Load("name") we are loading all assets with that name in resources folder.
We don't care about type of asset. If we have three assets with same name but different types like name.txt, name.prefab and name.mat, next we use Resources.Load("name") we will load those tree assets to memory.
We can filtrate returned result simply by using generic version of Load() method (or with method with second argument.) Even if we use generic version of method Load() it always load all assets with given path/name.
Answer by elenzil · May 09, 2017 at 11:45 PM
thanks @RafaelF82 and @Bunny83 - moved to feedback here, and closing this.
Follow this Question
Related Questions
Failed to recompile resources Facebook sdk integration with admob, unity ads plugin 1 Answer
Loading Resources folder contents in StandAlone Player 1 Answer
Best way use Resources.Load for spcific type? 1 Answer
Physic based golf game - ball bouncing off the connection of colliders on flat surface 2 Answers
Attaching objects on collision 1 Answer