UnityEditor.ScreenShots.GetUniquePathForName C# (CSharp) Method

GetUniquePathForName() private static method

private static GetUniquePathForName ( string name ) : string
name string
return string
        private static string GetUniquePathForName(string name)
        {
            string path = string.Format("{0}/../../{1}.png", Application.dataPath, name);
            for (int i = 0; File.Exists(path); i++)
            {
                path = string.Format("{0}/../../{1}{2:000}.png", Application.dataPath, name, i);
            }
            return path;
        }

Usage Example

示例#1
0
        public static void ScreenGameViewContent()
        {
            string uniquePathForName = ScreenShots.GetUniquePathForName("ContentExample");

            Application.CaptureScreenshot(uniquePathForName);
            Debug.Log(string.Format("Saved screenshot at {0}", uniquePathForName));
        }
All Usage Examples Of UnityEditor.ScreenShots::GetUniquePathForName