Example #1
0
        public override void Read(AssetReader reader)
        {
            PrefabInstanceLayout layout = reader.Layout.PrefabInstance;

            if (layout.IsModificationFormat)
            {
                ReadObject(reader);

                if (layout.HasRootGameObject && layout.IsRootGameObjectFirst)
                {
                    RootGameObject.Read(reader);
                }

                Modification.Read(reader);
                SourcePrefab.Read(reader);
                if (!layout.IsRootGameObjectFirst)
                {
                    RootGameObject.Read(reader);
                }
                if (layout.HasIsPrefabAsset)
                {
                    IsPrefabAsset = reader.ReadBoolean();
                }
                if (layout.HasIsExploded)
                {
                    IsExploded = reader.ReadBoolean();
                }
                reader.AlignStream();
            }
            else
            {
                LastMergeIdentifier.Read(reader);
                if (layout.HasLastTemplateIdentifier)
                {
                    LastTemplateIdentifier.Read(reader);
                }
                Objects        = reader.ReadAssetArray <PPtr <EditorExtension> >();
                Father         = reader.ReadAsset <PPtr <PrefabInstance> >();
                IsDataTemplate = reader.ReadBoolean();
                reader.AlignStream();

                base.Read(reader);
            }
        }
Example #2
0
        public override void Read(AssetReader reader)
        {
            if (IsModificationsFormat(reader.Version))
            {
                ReadObject(reader);

                bool isRootGameObjectFirst = IsRootGameObjectFirst(reader.Version);
                if (isRootGameObjectFirst && IsRootGameObjectRelevant(reader.Flags))
                {
                    RootGameObject.Read(reader);
                }

                Modification.Read(reader);
                SourcePrefab.Read(reader);
                if (!isRootGameObjectFirst)
                {
                    RootGameObject.Read(reader);
                }
                if (IsPrefabAssetRelevant(reader.Version))
                {
                    IsPrefabAsset = reader.ReadBoolean();
                }
                if (IsExplodedRelevant(reader.Version))
                {
                    IsExploded = reader.ReadBoolean();
                }
                reader.AlignStream();
            }
            else
            {
                LastMergeIdentifier.Read(reader);
                if (HasLastTemplateIdentifier(reader.Version))
                {
                    LastTemplateIdentifier.Read(reader);
                }
                Objects        = reader.ReadAssetArray <PPtr <EditorExtension> >();
                Father         = reader.ReadAsset <PPtr <PrefabInstance> >();
                IsDataTemplate = reader.ReadBoolean();
                reader.AlignStream();

                base.Read(reader);
            }
        }