Loading TextAsset returns null

Hi,

I’m in the process of writing a simple game and I’m loading some scene description from a text file. I imported my txt file into the assets (it is shown among models, textures and I can see contents in the editor) and load it using this code:

TextAsset textAsset = (TextAsset)Resources.Load("Resources/scene-desc", typeof(TextAsset));

The trouble is that textAsset is always null. I tried placing the fils in the Assets, Assets/Resources folder etc Nothing helped much. What am I doing wrong and how can I overcome this issue? Thanks!

The path you have to provide to Resources.Load is always relative to a Resources folder. Don’t include the “Resources” in your path unless you have a Resources folder in your Resources folder (which doesn’t make much sense and could even screw up Unity).