From Unify Community Wiki
(Difference between revisions)
Jump to: navigation, search
m (Text replace - "<csharp>" to "<syntaxhighlight lang="csharp">")
m (Text replace - "</csharp>" to "</syntaxhighlight>")
Line 38: Line 38:

Latest revision as of 20:47, 10 January 2012

Author: Jonathan Czeck (aarku)

[edit] Description

This editor script takes screenshots for you when you press command-control-s. The screenshots are numbered dependant on the existing files and are placed in the root level of your project. As of Unity 1.2.2, there are bugs or lack of features that allow the menu item to be placed in a location like the Window or File menu.

[edit] Usage

Place this script in YourProject/Assets/Editor and a menu item will automatically appear in the Custom menu after it is compiled.

[edit] C# - TakeScreenshotInEditor.cs

using UnityEngine;
using UnityEditor;
public class TakeScreenshotInEditor : ScriptableObject
    public static string fileName = "Editor Screenshot ";
    public static int startNumber = 1;
    [MenuItem ("Custom/Take Screenshot of Game View %^s")]
    static void TakeScreenshot()
        int number = startNumber;
        string name = "" + number;
        while (System.IO.File.Exists(fileName + name + ".png"))
            name = "" + number;
        startNumber = number + 1;
        Application.CaptureScreenshot(fileName + name + ".png");
Personal tools