How can I load an custom file from the Assets folder?

I have raw files that I have built a custom serializer for. All I want to do is to be able to load the files from the game. (They need to be part of the game itself (not saved/loaded from the user’s local files))

Okay I found a really hacky solution. If you put the file extension .txt at the end of the file name you can import the file as a text file. Then in your MonoBehavior create add a TextAsset property:

public TextAsset _textAsset;

Then you can access the file’s bytes with:


I hate this solution but it works.

Two Methods to Load a File to the Assets Folder:

Method 1:

1.) Right Click on the Assets Section of Unity
2.) Select “Import File”
3.) Select your File

Method 2:

1.) Open File Explorer if you’re on Windows, or Finder if you’re on Mac
2.) Drag the file from File Explorer/Finder into the Assets Section of Unity

Hope this helps