Class Automation
A collection of helper methods used for automation processes.
Inheritance
Namespace: GDX.Editor
Syntax
public static class Automation
Methods
| Improve this Doc View SourceCaptureAllWindows()
Capture a UnityEngine.Texture2D of all open UnityEditor.EditorWindow.
Declaration
public static Texture2D CaptureAllWindows()
Returns
Type | Description |
---|---|
UnityEngine.Texture2D | The UnityEngine.Texture2D captured. |
CaptureAllWindowsToPNG(String)
Captures a PNG image of all open UnityEditor.EditorWindow.
Declaration
public static bool CaptureAllWindowsToPNG(string outputPath)
Parameters
Type | Name | Description |
---|---|---|
System.String | outputPath | The absolute path for the image file. |
Returns
Type | Description |
---|---|
System.Boolean | true/false if the capture was successful. |
CaptureEditorWindow(EditorWindow)
Capture a UnityEngine.Texture2D of the editor window.
Declaration
public static Texture2D CaptureEditorWindow(EditorWindow window)
Parameters
Type | Name | Description |
---|---|---|
UnityEditor.EditorWindow | window |
Returns
Type | Description |
---|---|
UnityEngine.Texture2D | The UnityEngine.Texture2D captured. |
CaptureEditorWindow<T>(Boolean)
Capture a UnityEngine.Texture2D of the designated UnityEditor.EditorWindow.
Declaration
public static Texture2D CaptureEditorWindow<T>(bool shouldCloseWindow = true)
where T : EditorWindow
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | shouldCloseWindow |
Returns
Type | Description |
---|---|
UnityEngine.Texture2D | The UnityEngine.Texture2D captured. |
Type Parameters
Name | Description |
---|---|
T | The type of UnityEditor.EditorWindow to be captured. |
CaptureEditorWindowToPNG(EditorWindow, String)
Capture a PNG image of the provided window.
Declaration
public static bool CaptureEditorWindowToPNG(EditorWindow window, string outputPath)
Parameters
Type | Name | Description |
---|---|---|
UnityEditor.EditorWindow | window | The target window. |
System.String | outputPath | The absolute path for the image file. |
Returns
Type | Description |
---|---|
System.Boolean | true/false if the capture was successful. |
CaptureEditorWindowToPNG<T>(String, Boolean)
Capture a PNG image of the designated UnityEditor.EditorWindow.
Declaration
public static bool CaptureEditorWindowToPNG<T>(string outputPath, bool shouldCloseWindow = true)
where T : EditorWindow
Parameters
Type | Name | Description |
---|---|---|
System.String | outputPath | The absolute path for the image file. |
System.Boolean | shouldCloseWindow | Should the gotten window be closed after the capture? |
Returns
Type | Description |
---|---|
System.Boolean | true/false if the capture was successful. |
Type Parameters
Name | Description |
---|---|
T | The type of UnityEditor.EditorWindow to be captured. |
CaptureFocusedEditorWindow()
Capture a UnityEngine.Texture2D of the focused editor window.
Declaration
public static Texture2D CaptureFocusedEditorWindow()
Returns
Type | Description |
---|---|
UnityEngine.Texture2D | The UnityEngine.Texture2D captured. |
CaptureFocusedEditorWindowToPNG(String)
Capture a PNG image of the currently focused window.
Declaration
public static bool CaptureFocusedEditorWindowToPNG(string outputPath)
Parameters
Type | Name | Description |
---|---|---|
System.String | outputPath | The absolute path for the image file. |
Returns
Type | Description |
---|---|
System.Boolean | true/false if the capture was successful. |
ClearTempFolder(Boolean)
Clear the automation temporary folder.
Declaration
public static void ClearTempFolder(bool deleteFolder = false)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | deleteFolder | Should the automation folder be deleted? |
FinishProfile()
Stop an existing profile, this is most often used to end a command line profile of the Editor startup.
Declaration
public static void FinishProfile()
Remarks
The editor needs to be started with profiling arguments; more info can be found on https://docs.unity3d.com/Manual/EditorCommandLineArguments.html.
Argument | Description |
---|---|
-profiler-enable | Enable profile at start. |
-profiler-log-file [path/to/file.raw] | The absolute path to where the profiling data should be stored. |
-profiler-maxusedmemory [bytesize] | The maximum amount of memory for the profiler to use. |
-deepprofiling | Should a deep profile be done? |
-executeMethod GDX.Editor.Automation.FinishProfile | Executes this method to stop the profiling. |
GenerateProjectFiles()
Generate the project's solution and associated project files.
Declaration
public static void GenerateProjectFiles()
GetEditorBounds()
Accumulate the screen space bounds of all editor windows.
Declaration
public static Bounds GetEditorBounds()
Returns
Type | Description |
---|---|
UnityEngine.Bounds | The accumulated bounds. |
GetGameView()
Returns a reference to the first available GameView.
Declaration
public static EditorWindow GetGameView()
Returns
Type | Description |
---|---|
UnityEditor.EditorWindow | An reference to an instance of the GameView |
GetWindow<T>(EditorWindowExtensions.EditorWindowSetup)
Declaration
public static T GetWindow<T>(EditorWindowExtensions.EditorWindowSetup setup)
where T : EditorWindow
Parameters
Type | Name | Description |
---|---|---|
EditorWindowExtensions.EditorWindowSetup | setup |
Returns
Type | Description |
---|---|
T |
Type Parameters
Name | Description |
---|---|
T |
GetWindow<T>(Boolean, Int32, Int32)
Get the existing or open a new window with the indicated size / flags.
Declaration
public static T GetWindow<T>(bool shouldMaximize = false, int width = 800, int height = 600)
where T : EditorWindow
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | shouldMaximize | Should the window be maximized? |
System.Int32 | width | The desired window pixel width. |
System.Int32 | height | The desired window pixel height. |
Returns
Type | Description |
---|---|
T | The instantiated window, or null. |
Type Parameters
Name | Description |
---|---|
T | The type of the window requested. |
Remarks
Maintains old behaviour.
ResetEditor()
Reset the editor to a default state.
Declaration
public static void ResetEditor()
Remarks
Using this method inside of a unit test will break the runner/chain.
RestoreWindowLayout()
Declaration
public static void RestoreWindowLayout()
StashWindowLayout()
Declaration
public static void StashWindowLayout()