Beispiel #1
0
        protected override YAMLMappingNode ExportYAMLRoot(IExportContainer container)
        {
            YAMLMappingNode node = base.ExportYAMLRoot(container);

            if (HasCorrespondingSourceObject(container.ExportFlags))
            {
                node.Add(GetCorrespondingSourceObjectName(container.ExportVersion), CorrespondingSourceObject.ExportYAML(container));
                node.Add(GetPrefabInstanceName(container.ExportVersion), GetPrefabInstance(container).ExportYAML(container));
            }
            if (HasPrefabAsset(container.ExportVersion, container.ExportFlags))
            {
                node.Add(PrefabAssetName, PrefabAsset.ExportYAML(container));
            }
            return(node);
        }
Beispiel #2
0
        public override IEnumerable <Object> FetchDependencies(ISerializedFile file, bool isLog = false)
        {
            foreach (Object asset in base.FetchDependencies(file, isLog))
            {
                yield return(asset);
            }

#if UNIVERSAL
            yield return(CorrespondingSourceObject.FetchDependency(file));

            yield return(PrefabInstance.FetchDependency(file));

            yield return(PrefabAsset.FetchDependency(file));
#endif
        }
Beispiel #3
0
        public override void Write(AssetWriter writer)
        {
            base.Write(writer);

#if UNIVERSAL
            if (HasCorrespondingSourceObject(writer.Flags))
            {
                CorrespondingSourceObject.Write(writer);
                PrefabInstance.Write(writer);
            }
            if (HasPrefabAsset(writer.Version, writer.Flags))
            {
                PrefabAsset.Write(writer);
            }
#endif
        }
Beispiel #4
0
        public override void Read(AssetReader reader)
        {
            base.Read(reader);

#if UNIVERSAL
            if (HasCorrespondingSourceObject(reader.Flags))
            {
                CorrespondingSourceObject.Read(reader);
                PrefabInstance.Read(reader);
            }
            if (HasPrefabAsset(reader.Version, reader.Flags))
            {
                PrefabAsset.Read(reader);
            }
#endif
        }
        protected override YAMLMappingNode ExportYAMLRoot(IExportContainer container)
        {
            YAMLMappingNode       node   = base.ExportYAMLRoot(container);
            EditorExtensionLayout layout = container.ExportLayout.EditorExtension;

            if (layout.HasExtensionPtr)
            {
                node.Add(layout.ExtensionPtrName, ExtensionPtr.ExportYAML(container));
            }
            if (layout.HasCorrespondingSourceObject)
            {
                node.Add(layout.CorrespondingSourceObjectInvariantName, CorrespondingSourceObject.ExportYAML(container));
                node.Add(layout.PrefabInstanceInvariantName, GetPrefabInstance(container).ExportYAML(container));
            }
            if (layout.HasPrefabAsset)
            {
                node.Add(layout.PrefabAssetName, PrefabAsset.ExportYAML(container));
            }
            return(node);
        }
        public override void Write(AssetWriter writer)
        {
            base.Write(writer);

#if UNIVERSAL
            EditorExtensionLayout layout = writer.Layout.EditorExtension;
            if (layout.HasExtensionPtr)
            {
                ExtensionPtr.Write(writer);
            }
            if (layout.HasCorrespondingSourceObject)
            {
                CorrespondingSourceObject.Write(writer);
                PrefabInstance.Write(writer);
            }
            if (layout.HasPrefabAsset)
            {
                PrefabAsset.Write(writer);
            }
#endif
        }
        public override void Read(AssetReader reader)
        {
            base.Read(reader);

#if UNIVERSAL
            EditorExtensionLayout layout = reader.Layout.EditorExtension;
            if (layout.HasExtensionPtr)
            {
                ExtensionPtr = reader.ReadAsset <PPtr <Object> >();
            }
            if (layout.HasCorrespondingSourceObject)
            {
                CorrespondingSourceObject.Read(reader);
                PrefabInstance.Read(reader);
            }
            if (layout.HasPrefabAsset)
            {
                PrefabAsset.Read(reader);
            }
#endif
        }
        public override void Read(AssetReader reader)
        {
            base.Read(reader);

#if UNIVERSAL
            if (HasEditorPtrs(reader.Flags))
            {
                if (HasCorrespondingSourceObject(reader.Version, reader.Flags))
                {
                    CorrespondingSourceObject.Read(reader);
                    PrefabInstance.Read(reader);
                }
                else
                {
                    ExtensionPtr = reader.ReadAsset <PPtr <Object> >();
                }
                if (HasPrefabAsset(reader.Version, reader.Flags))
                {
                    PrefabAsset.Read(reader);
                }
            }
#endif
        }