Hello Mod Community!
I'm currently developing a mod which requires the selection of an or several image(s) by the player. Preferably I would like to do using the Windows File Explorer. I've tried two methods, using UnityEngine and another one using System.Windows.Forms. None of them worked and I've heard that apparently people have had issues with the file explorer when modding before...
UnityEditor method
EditorUtility.OpenFilePanel("Select reference image!", "", "png");
Which gave me this error:
I heard the apparently KSP doesn't use UnityEditor so I added the UnityEditor.dll file into the plugins folder which changed the error from the beforementioned one to this one:
Anyone have any experience with UnityEditor and KSP modding, please let me know!
System Windows Forms method
string refImgPath = "";
OpenFileDialog fileDialog_ = new OpenFileDialog();
fileDialog_.InitialDirectory = @"c:\";
fileDialog_.Filter = "png";
fileDialog_.RestoreDirectory = false;
if (fileDialog_.ShowDialog() == DialogResult.OK)
{
refImgPath = fileDialog_.FileName;
}
Debug.Log(refImgPath);
Which gave me this error:
I didn't know where to continue from here, anyone know what's wrong? Basically I need help with getting an file (image) explorer window working to get the path to any given image. Thank you in advance for any help!