public static void CreateFromSyncPrefabScriptedImporter()
        {
            var guids = Selection.assetGUIDs;

            if (guids.Length == 0)
            {
                return;
            }

            foreach (string guid in guids)
            {
                var path  = AssetDatabase.GUIDToAssetPath(guid);
                var asset = (SyncPrefabScriptedImporter)AssetImporter.GetAtPath(path);
                if (asset == null)
                {
                    continue;
                }

                Dictionary <string, Material> remaps;
                asset.GetRemaps(out remaps);

                var remapper = MaterialMappings.CreateInstance(remaps);

                AssetDatabase.CreateAsset(remapper, Path.Combine(Path.GetDirectoryName(path), Path.GetFileNameWithoutExtension(path)) + "_material-mappings.asset");
                AssetDatabase.SaveAssets();
            }
        }
        public static void CreateFromMaterialSelection()
        {
            var guids = Selection.assetGUIDs;

            if (guids.Length == 0)
            {
                return;
            }

            var remapsList = new List <Material>();

            foreach (string guid in guids)
            {
                var path     = AssetDatabase.GUIDToAssetPath(guid);
                var material = AssetDatabase.LoadAssetAtPath <Material>(path);
                if (material == null)
                {
                    continue;
                }
                remapsList.Add(material);
            }

            var remapper = MaterialMappings.CreateInstance(remapsList.ToArray());

            var targetPath = EditorUtility.SaveFilePanel(
                "Save New Material Mappings",
                Application.dataPath,
                "",
                "asset");

            if (targetPath.Length != 0)
            {
                if (!targetPath.StartsWith(Application.dataPath))
                {
                    Debug.LogError("Cannot save asset outside of project's assets folder!");
                    return;
                }
                targetPath = "Assets" + targetPath.Substring(Application.dataPath.Length);
                AssetDatabase.CreateAsset(remapper, targetPath);
                AssetDatabase.SaveAssets();
            }
        }