- Home /
64k limit when convert byte[] to base64 string
us there a way to avoid/trick the limitation of 16bit strings, so they support like 32bits(4billions).
problem appears when converting Texture2D to byte[] to string.
need this for loading a texture by code
Comment
Best Answer
Answer by kaarloew · Mar 14, 2019 at 07:19 AM
What method you used for byte[] to base64 string conversion? Convert.ToBase64String ?
yes indeed.
texture > encodetopng
byte[] => toBase64String
Convert.ToBase64String works just fine, so I am assu$$anonymous$$g your problem is in some other part of the code
private static System.Random rng = new System.Random();
private static int arrayLength = 1024 * 1024;
void Start()
{
byte[] byteArray = new byte[arrayLength];
rng.NextBytes(byteArray);
string base64str = Convert.ToBase64String(byteArray);
Debug.Log(base64str.Length);
}
yes. I see now what's the problem. 64k Limitation is in Inspector not inside script.. well need to export the string as a txt file. thanks for the Help