So to make sure there's no legal problems with using this code, here's a re-upload of my OpenFileInBrowser code for Unity here in my blog.
As always, I put this code in Public Domain as it's quite simple but good enough to be shared.
public static class OpenInFileBrowser { public static bool IsInMacOS { get { return SystemInfo.operatingSystem.IndexOf("Mac OS") != -1; } } public static bool IsInWinOS { get { return SystemInfo.operatingSystem.IndexOf("Windows") != -1; } } [MenuItem("Window/Test OpenInFileBrowser")] public static void Test() { //string path = "/Users/Ferds/Unity Projects/BuildReportTool/BuildReportUnityProject/Assets/BuildReportDebug"; //string path = "/Users/Ferds/Unity Projects/BuildReportTool/BuildReportUnityProject/Assets/BuildReportDebug/EditorMorel.log.txt"; //string path = "/Users/Ferds/UnityBuildReports/"; string path = "/Users/Ferds/UnityBuildReports/test4.xml"; Open(path); } public static void OpenInMac(string path) { bool openInsidesOfFolder = false; // try mac string macPath = path.Replace("\\", "/"); // mac finder doesn't like backward slashes if (Directory.Exists(macPath)) // if path requested is a folder, automatically open insides of that folder { openInsidesOfFolder = true; } //Debug.Log("macPath: " + macPath); //Debug.Log("openInsidesOfFolder: " + openInsidesOfFolder); if (!macPath.StartsWith("\"")) { macPath = "\"" + macPath; } if (!macPath.EndsWith("\"")) { macPath = macPath + "\""; } string arguments = (openInsidesOfFolder ? "" : "-R ") + macPath; //Debug.Log("arguments: " + arguments); try { System.Diagnostics.Process.Start("open", arguments); } catch(System.ComponentModel.Win32Exception e) { // tried to open mac finder in windows // just silently skip error // we currently have no platform define for the current OS we are in, so we resort to this e.HelpLink = ""; // do anything with this variable to silence warning about not using it } } public static void OpenInWin(string path) { bool openInsidesOfFolder = false; // try windows string winPath = path.Replace("/", "\\"); // windows explorer doesn't like forward slashes if (Directory.Exists(winPath)) // if path requested is a folder, automatically open insides of that folder { openInsidesOfFolder = true; } try { System.Diagnostics.Process.Start("explorer.exe", (openInsidesOfFolder ? "/root," : "/select,") + winPath); } catch(System.ComponentModel.Win32Exception e) { // tried to open win explorer in mac // just silently skip error // we currently have no platform define for the current OS we are in, so we resort to this e.HelpLink = ""; // do anything with this variable to silence warning about not using it } } public static void Open(string path) { if (IsInWinOS) { OpenInWinFileBrowser(path); } else if (IsInMacOS) { OpenInMacFileBrowser(path); } else // couldn't determine OS { OpenInWinFileBrowser(path); OpenInMacFileBrowser(path); } } }
Hi Ferdinand!
ReplyDeleteSorry to post here, could not find your e-mail. It is that your Silhouette shader in Unity is having some problems with PSD textures, spreading outlines all over it. When I save the same texture under PNG, everything is great. This does not happen with every PSD, since when I used a very simple all-white PSD, it worked. Only on more complex PSDs. If you want the files to see for yourself, please write to me at oozeslime@gmail.com
Thanks for the shader!
Robson