I have a class that downloads some assets from a server in the Internet, in editor-time, and stores them in the Resources folder in order to make them available in run-time. The path in which they are stored depends on some data inside the asset. For instance, if the asset is of type A and its name is B, it is stored in Resources/Products/A/B.asset.
My issue is that sometimes Unity will perform character substitution in the asset path when it encounters invalid characters. It does not give an error nor a warning when it executes
AssetDatabase.CreateFolder, it just creates a folder with a different name. I am trying to figure out which characters are not valid and how they are substituted, in order to be able to predict what the name of the created folder will be. Of course, I could create the folder, then load it using its GUID and get the path, but for convenience I would like to know the name before the substitution occurs, if possible, to prevent creating a folder that already exists.
I have tried using
Path.GetInvalidPathChars() but it does not seem to cover all cases. I have tried many non-ASCII characters and Unity will accept them. It will accept many asiatic characters too. But then characters like
* are substituted by a
_, even though
* is not in
About the resulting path name, I have observed that the invalid characters are substituted by an
_, but I would like to be sure that this will always be the case.
Can anyone give some insight into this?
Thanks in advance.