public void Open() { OpenFileName ofn = new OpenFileName(); ofn.dlgOwner = DllTest.GetActiveWindow(); // makes the window modal, but also causes flicker, solved by two WaitForEndOfFrame in coroutine ofn.structSize = Marshal.SizeOf(ofn); ofn.filter = "PNG Files\0*.png\0All Files\0*.*\0"; ofn.file = new string(new char[256]); ofn.maxFile = ofn.file.Length; ofn.fileTitle = new string(new char[64]); ofn.maxFileTitle = ofn.fileTitle.Length; ofn.initialDir = Environment.CurrentDirectory; ofn.title = "Open Project"; ofn.defExt = "PNG"; ofn.flags = 0x00080000 | 0x00001000 | 0x00000800 | 0x00000200 | 0x00000008;//OFN_EXPLORER|OFN_FILEMUSTEXIST|OFN_PATHMUSTEXIST| OFN_ALLOWMULTISELECT|OFN_NOCHANGEDIR if (DllTest.GetSaveFileName(ofn)) { StartCoroutine(TakeScreenShot(ofn)); } }