public void GuessFilepath() { string n = m_NameInput.text; if (n.Trim().Length < 1) { n = "Untitled"; } string filename = VCUtils.MakeFileName(n); string s = m_SaveLocInput.text; int lstidx = Mathf.Max(s.LastIndexOf("\\"), s.LastIndexOf("/")); if (lstidx >= 0) { m_SaveLocInput.text = s.Substring(0, lstidx + 1) + filename; } else { m_SaveLocInput.text = filename; } m_SaveLocInput.text = m_SaveLocInput.text.Trim(); string test_fn = m_SaveLocInput.text; int p_pos = test_fn.LastIndexOf(" ("); int n_pos = test_fn.LastIndexOf(")"); int i = 2; if (p_pos > 0 && n_pos == test_fn.Length - 1) { try { i = Convert.ToInt32(test_fn.Substring(p_pos + 2, n_pos - p_pos - 2)); test_fn = test_fn.Substring(0, p_pos); } catch (Exception) { i = 2; } } while (File.Exists(VCConfig.s_IsoPath + m_SaveLocInput.text + VCConfig.s_IsoFileExt) && m_SaveLocInput.text + VCConfig.s_IsoFileExt != VCEditor.s_Scene.m_DocumentPath) { m_SaveLocInput.text = test_fn + " (" + i.ToString() + ")"; ++i; } }