Class EditorWindowPanelSimulator
A PanelSimulator accessing an EditorWindow's panel.
Allows for the simulation of time passing, sending events,
and updating the panel in a synchronous manner.
Inherited Members
Namespace: UnityEditor.UIElements.TestFramework
Assembly: Unity.UI.TestFramework.Editor.dll
Syntax
public sealed class EditorWindowPanelSimulator : PanelSimulator
Constructors
EditorWindowPanelSimulator(EditorWindow)
Sets up the provided window for simulation.
Declaration
public EditorWindowPanelSimulator(EditorWindow window)
Parameters
| Type | Name | Description |
|---|---|---|
| EditorWindow | window | The |
Properties
needsImprovedIMGUISupport
Whether events are sent within an IMGUI context.
Set this to true if the EditorWindow contains IMGUI content.
Defaults to false.
Declaration
public bool needsImprovedIMGUISupport { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
window
EditorWindow tied to the panel.
Declaration
public EditorWindow window { get; }
Property Value
| Type | Description |
|---|---|
| EditorWindow |
Methods
ExecuteWithinIMGUIContext(Action)
Function that will invoke an Action after setting up the native EditorWindow's IMGUI context.
This ensures that the provided command will be executed within the IMGUI Update loop.
Declaration
public void ExecuteWithinIMGUIContext(Action command)
Parameters
| Type | Name | Description |
|---|---|---|
| Action | command | The Action to be executed. |
FrameUpdate(double)
Performs a frame update of the panel.
Declaration
public override sealed void FrameUpdate(double time)
Parameters
| Type | Name | Description |
|---|---|---|
| double | time | The amount of time in seconds to increment the simulated time. |
Overrides
Remarks
This method simulates yielding a frame by the following:
- Updates the scheduler and the panel's visual tree updaters.
- Advances the time by the amount specified in time.
- When needsRendering is true, it triggers rendering for the panel's `ImmediateModeElement` and invokes `IMGUIContainer`'s `OnGUI` with a Repaint Event.
- When needsImprovedIMGUISupport is true, the update will be executed within an IMGUI context.
See Also
SetWindow(EditorWindow)
Assigns the specified window to the EditorWindowPanelSimulator.
Declaration
public void SetWindow(EditorWindow window)
Parameters
| Type | Name | Description |
|---|---|---|
| EditorWindow | window | The |