public byte[] ToGlbBytes(ArraySegment <Byte> bytes, bool UseUniJSONSerializer = false) { string json; if (UseUniJSONSerializer) { var f = new JsonFormatter(); f.Serialize(this); json = Encoding.UTF8.GetString(f.GetStoreBytes().ToArray()); } else { json = ToJson(); } RemoveUnusedExtensions(json); return(Glb.ToBytes(json, bytes)); }
public void PrimitiveTest() { var prims = new List <glTFPrimitives> { new glTFPrimitives { attributes = new glTFAttributes { POSITION = 0, } } }; var f = new JsonFormatter(); f.Serialize(prims); var json = new Utf8String(f.GetStoreBytes()).ToString(); Debug.Log(json); }