привет помоги с рефакторингом кода для unity 
 public class PdfFilesUI : MonoBehaviour
    {
        private const string PathName = "/StreamingAssets/PDF";
        private const string FileExtension = "*.pdf";
        private const string PathConverter = "/../Converter/pdf2img.exe";
        private const string PathImage = " pageRight.png ";
        private const string PathImageFull = "/../pageRight.png";
        [SerializeField]
        private Transform _contentButton;
        [SerializeField]
        private Transform _contentImage;
        [SerializeField]
        private PDFbutton _buttonPrefab;
        [SerializeField]
        private Image _imagePrefab;
        private string pdfConverterPath;
        private Dictionary<Button, Image[]> buttonToImagesMapping = new Dictionary<Button, Image[]>();
        private List<Image[]> allImageGroups = new List<Image[]>();
        public void Initialized()
        {
            pdfConverterPath = Application.dataPath + PathConverter;
            FindPdfFiles();
        }
        private void FindPdfFiles()
        {
            string folderPath = Application.dataPath + PathName;
            string[] pdfFiles = Directory.GetFiles(folderPath, FileExtension, SearchOption.AllDirectories);
            foreach (string file in pdfFiles)
            {
                string fileNameWithoutExtension = Path.GetFileNameWithoutExtension(file);
                var button = Instantiate(_buttonPrefab, _contentButton);
                button.Initialized(fileNameWithoutExtension, file);
                int pageCount = 0;
                using (PdfReader reader = new PdfReader(file))
                {
                    pageCount = reader.NumberOfPages;
                }
                var imageGroup = new Image[pageCount];
                for (int pageNumber = 0; pageNumber < pageCount; pageNumber++)
                {
                    CallExternalProcess(pdfConverterPath, file + PathImage + (pageNumber).ToString());
                    var image = ApplyTextureToUI(Application.dataPath + PathImageFull);
                    imageGroup[pageNumber] = image;
                }
                allImageGroups.Add(imageGroup);
                button.Button.onClick.AddListener(() => AllImagesOn(imageGroup));
                buttonToImagesMapping[button.Button] = imageGroup;
            }
            AllImagesOff();
        }
        public void AllImagesOff()
        {
            foreach (Image[] images in allImageGroups)
            {
                foreach (var image in images)
                {
                    image.gameObject.Deactive();
                }
            }
        }
        public void AllImagesOn(Image[] imageGroup)
        {
            AllImagesOff();
            foreach (Image image in imageGroup)
            {
                image.gameObject.Active();
            }
        }
        public Texture2D LoadPNG(string filePath)
        {
            Texture2D texture = null;
            byte[] fileData;
            if (File.Exists(filePath))
            {
                fileData = File.ReadAllBytes(filePath);
                texture = new Texture2D(2, 2);
                texture.LoadImage(fileData);
            }
            return texture;
        }
        public Image ApplyTextureToUI(string filePath)
        {
            Texture2D texture = LoadPNG(filePath);
            if (texture != null)
            {
                Sprite sprite = Sprite.Create(texture, new Rect(0, 0, texture.width, texture.height), new Vector2(0.5f, 0.5f), 100.0f);
                var image = Instantiate(_imagePrefab, _contentImage);
                image.sprite = sprite;
                return image;
            }
            return null;
        }
        public void CallExternalProcess(string processPath, string arguments)
        {
            Process myProcess = new Process();
            myProcess.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
            myProcess.StartInfo.CreateNoWindow = true;
            myProcess.StartInfo.UseShellExecute = false;
            myProcess.StartInfo.FileName = processPath;

            myProcess.StartInfo.Arguments = arguments;
            myProcess.EnableRaisingEvents = true;
            myProcess.Start();
            myProcess.WaitForExit();
            int ExitCode = myProcess.ExitCode;
        }
    }