Beispiel #1
0
        public static GameObject DeserializeGameObjectReference(Stream stream)
        {
            var b = Basic.ReadByte(stream);

            if (b == 0)
            {
                return(null);
            }

            if (b == 1)
            {
                var prefabId = stream.ReadInt();
                return(PrefabStorage.Current.Get(prefabId));
            }
            else
            {
                var refId = stream.ReadInt();
                return(FSReference.Get(refId));
            }
        }
Beispiel #2
0
        static Component DeserializeComponentReference(Stream stream, Type type)
        {
            byte b = Basic.ReadByte(stream);

            if (b == 0)
            {
                return(null);
            }

            if (b == 1)
            {
                var prefabId = stream.ReadInt();
                var go       = PrefabStorage.Current.Get(prefabId);
                return(go.GetComponent(type));
            }
            else
            {
                var refId = stream.ReadInt();
                var go    = FSReference.Get <Component>(refId);
                return(go.GetComponent(type));
            }
        }