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)
Invokes an Action after setting up the EditorWindow's IMGUI context.
This ensures that the IMGUI state is properly setup when executing the provided command.
Declaration
public void ExecuteWithinIMGUIContext(Action command)
Parameters
| Type | Name | Description |
|---|---|---|
| Action | command | The |
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:
- Advances the panel's time by the specified
time. - Updates the panel's scheduler and visual tree updaters.
- If needsRendering is true, triggers rendering for the panel's
ImmediateModeElementand invokesIMGUIContainer'sOnGUIwith a Repaint Event. - If needsImprovedIMGUISupport is true, the update is 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 |