# TextAsset thinks file is ~6856 bytes when it is 120123 bytes

So I've created a text asset in Unity of a binary file which i'm attempting to read in as a byte array.

The result I'm getting is a byte array tht is almost half the size it's supposed to be.

The file is a serialized mesh file from here: http://wiki.unity3d.com/index.php?title=MeshSerializer2

What I do then is find the file unity created, move it to the assets folder and drag it into a component as a TextAsset. For smaller files it works but larger ones appear to fail to load completely.

If I load the same file separately from a C# console application using filestream it loads correctly.

• When you want Unity to load a non-text file as a text asset properly, you need to give it the file extension .bytes. Did you do that? – Philipp Oct 17 '16 at 10:42
• I actually tried that shortly after making this post and it worked, feel free to put that in as an answer andI'll mark it correct. – meds Oct 17 '16 at 12:59

When you want Unity to load a non-text file as a text asset properly, you need to give it the file extension .bytes. Otherwise it is possible that Unity interprets certain bit sequences as the end of the file and truncates it. It is also required to allow you to access the bytes property of the text asset, which you will likely need for your use-case.