public ExposedComponent[] GetComponents(ExposedGameObject go, VerticalActivitySlice slice)
        {
            if (go == null || go.components == null)
                return null;

            if (slice == null || slice.gameObjectsSnapshot == null || slice.gameObjectsSnapshot.components == null)
                return null;

            long key = vBugMathHelper.CombineInts(go.transformID, slice.header.frameNumber);
            if (componentsPerGO.ContainsKey(key)) {
                return componentsPerGO[key];
            } else {
                int i = go.components.Length;
                ExposedComponent[] allComponents = slice.gameObjectsSnapshot.components;
                ExposedComponent[] result = new ExposedComponent[i];
                while (--i > -1)
                    result[i] = allComponents[go.components[i]];

                componentsPerGO.Add(key, result);
                return result;
            }
        }
 public GameObjectsSnapshot(ExposedGameObject[] gameObjects, ExposedComponent[] components)
 {
     this.gameObjects = gameObjects;
     this.components = components;
 }
        //--------------- SERIALIZE --------------------
        public static byte[] SerializeArray(ExposedComponent[] input)
        {
            if (input == null) return null;
            ComposedByteStream stream = ComposedByteStream.FetchStream();
            for (int i = 0; i < input.Length; i++)
                stream.AddStream(Serialize(input[i]));

            return stream.Compose();
        }
        public static byte[] Serialize(ExposedComponent input)
        {
            if (input == null) return null;
            ComposedPrimitives prims = new ComposedPrimitives();
            prims.AddValue(input.instanceID);
            prims.AddValue(input.enabled);

            ComposedByteStream stream = ComposedByteStream.FetchStream();

            stream.AddStream(prims.Compose());
            stream.AddStream(input.name);
            stream.AddStream(SerializeExposedObject(input));
            return stream.Compose();
        }
        //--------------- SERIALIZE --------------------
        //--------------- DESERIALIZE --------------------
        public static new ExposedComponent[] DeserializeArray(byte[] input)
        {
            // Hides ExposedObject.DeserializeArray();
            if (input == null)
                return null;

            ComposedByteStream stream = ComposedByteStream.FromByteArray(input);
            if (stream == null)
                return null;

            int iMax = stream.streamCount;
            ExposedComponent[] result = new ExposedComponent[iMax];
            for (int i = 0; i < iMax; i++)
                result[i] = Deserialize(stream.ReadNextStream<byte>());

            stream.Dispose();
            return result;
        }
        public static new ExposedComponent Deserialize(byte[] input)
        {
            if (input == null)
                return null;

            ComposedByteStream stream = ComposedByteStream.FromByteArray(input);
            if (stream == null)
                return null;

            ExposedComponent result = new ExposedComponent();
            ComposedPrimitives prims = ComposedPrimitives.FromByteArray(stream.ReadNextStream<byte>());
            result.instanceID = prims.ReadNextValue<int>();
            result.enabled = prims.ReadNextValue<bool>();
            result.name = stream.ReadNextStream();

            ComposedByteStream subStream = ComposedByteStream.FromByteArray(stream.ReadNextStream<byte>());
            if (subStream == null)
                return null;

            DeserializeExposedObject(ref subStream, result);

            subStream.Dispose();
            stream.Dispose();
            return result;
        }