Пример #1
0
        public ExportPointer CreateExportPointer(Object @object)
        {
            if (!IsExporting)
            {
                throw new InvalidOperationException("Export pointer could be used only during export process");
            }

            foreach (IExportCollection collection in m_collections)
            {
                foreach (Object element in collection.Objects)
                {
                    if (element == @object)
                    {
                        return(collection.CreateExportPointer(element, collection == m_currentCollection));
                    }
                }
            }

            if (Config.IsExportDependencies)
            {
                throw new InvalidOperationException($"Object {@object} wasn't found in any export collection");
            }
            else
            {
                string exportID = AssetExportCollection.GetMainExportID(@object);
                return(new ExportPointer(exportID, UnityGUID.MissingReference, AssetType.Meta));
            }
        }
Пример #2
0
        public string GetExportID(Object @object)
        {
            if (!IsExporting)
            {
                throw new InvalidOperationException("Export pointer can only be used during export process");
            }

            foreach (IExportCollection collection in m_collections)
            {
                foreach (Object element in collection.Objects)
                {
                    if (element == @object)
                    {
                        return(collection.GetExportID(@object));
                    }
                }
            }

            if (Config.IsExportDependencies)
            {
                throw new InvalidOperationException($"Object {@object} wasn't found in any export collection");
            }
            else
            {
                return(AssetExportCollection.GetMainExportID(@object));
            }
        }