- Home /
Question by
BenoitFreslon · Apr 01, 2014 at 10:37 PM ·
resources.load
Load file name form Resources folder with special characters
Hello,
I have a lot of file names with special characters.
cheminée.png café.png forêt.png
Is it possible to load the image file from the ressource folder using the exact file name with special characters?
Like this ?
Resources.Load<Sprite> ("images/café");
Thanks.
Comment
Answer by Crazydadz · Apr 03, 2014 at 12:46 AM
Yes it is possible (Oui c'est possible). Special Characters works in file name. If you wanna load your file as Sprite, you need to set the texture to Sprite in the TextureImporter of Unity. And your line of code should work.
If you don't want to set your texture to Sprite, you can create a Sprite from a texture like this
Texture2D _image;
Sprite _sprite;
private void Start()
{
_image = Resources.Load<Texture2D>("café"); //Loading your texture
_sprite = Sprite.Create(_image,new Rect(0,0,0,0),Vector2.zero); //Creating the sprite with your loaded texture
}
Your answer
![](https://koobas.hobune.stream/wayback/20220613141729im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Goods and bads about using Resources.load 4 Answers
Problem in loading images from resources.load(). 2 Answers
How to check the path on Android 0 Answers