void OnPreprocessTexture() { Debug.Log("SpriteSheetImporter::OnPreprocessTexture " + assetPath); if (!(assetPath.StartsWith(ImagePrefix) && assetPath.Contains("sheet"))) { return; } LoadTextureJson(); var path = assetPath.Replace(ImagePrefix, ""); string dirname = BaseUtils.GetDirname(path); if (!textureJson.Keys.Contains(dirname)) { return; } var sheetDef = textureJson [dirname]; var isPacked = false; foreach (var key in sheetDef.Keys) { var spriteDef = sheetDef [key]; var src = string.Format("{0}/{1}", dirname, spriteDef ["src"].Value); if (path == src) { isPacked = true; break; } } if (!isPacked) { return; } Debug.Log("Importing spritesheet..." + assetPath); UpdateTextureImporter(sheetDef, (TextureImporter)assetImporter, path, dirname); }