In C or C++, we can write the value of a variable directly onto a byte array.
int value = 3;
unsigned char array[100];
*(int*)(&array[10]) = value;
In C#, we also can do this by using unsafe and fixed keyword.
int value = 3;
byte[] array = new byte[100];
fixed(...) { ... }
However, Unity3D does not allow using unsafe nor fixed. In this case, what is the runtime cost-efficient way of doing it? I roughly guess it can be done with using a binary reader or writer class in .Net Core or .Net Framework, but I am not sure of it.
chararray is not abytearray. Waht do you want to get?intin char array, or in general?intin the middle of char or byte array.unsafeandfixedkeywords. See Djeurissen's answer