Play In Editor
Overview
Play In Editor (PIE) is a useful tool to quickly preview gameplay in a level while editing, but there are some things programmers will need to know about how the game world interacts with the editor world.
Play In Editor Window
This method of playing the level inside of the editor loads the current map into a new window, starting the player from a standard PlayerStart (or however your gametype places the player) as the location of the player.
There are two ways to initiate this method of PIE:
- Select In Editor options from the Play menu of the level editor.
- Click on the button in the main editor tool bar.
Holding Ctrl when initiating the PIE session will attach ?spectator
to the PIE game's URL forcing the player to start in spectator mode.
Further, the string specified by the editor .ini setting, InEditorGameURLOptions
, will be appended to the PIE game's URL.
Play In Editor Viewport
This method of playing the level inside of the editor loads the current map into the current viewport, starting the player from the current location of the viewport camera.
To initiate this method of PIE:
This method of starting the PIE session will place a teleporter actor in the map at the location of the viewport camera and then pass the name of the teleporter to the PIE game. The default implementation of GameInfo will spawn the player at the location of the teleporter (again, your game type can override this behavior).
Holding Ctrl when initiating the PIE session will attach ?spectator
to the PIE game's URL forcing the player to start in spectator mode.
Further, the string specified by the editor .ini setting, InEditorGameURLOptions
, will be appended to the PIE game's URL.
Play From Here
This method of playing the level inside of the editor loads the current map into either a new window or the current viewport, starting the player from the location clicked in the viewport.
There are 2 ways to initiate this method of PIE:
- Right-click in a perspective view, and select Play Level > Play from Here in Viewport from the context menu.
- Right-click in a perspective view, and select Play from Here from the context menu.
These methods of starting the PIE session will place a teleporter actor in the map at the location of the right-click and then pass the name of the teleporter to the PIE game. The default implementation of GameInfo will spawn the player at the location of the teleporter (again, your game type can override this behavior).
Holding Ctrl when initiating the PIE session will attach ?spectator
to the PIE game's URL forcing the player to start in spectator mode.
Further, the string specified by the editor .ini setting, InEditorGameURLOptions
, will be appended to the PIE game's URL.
Using PIE
Dropping Notes
While in PIE you can drop Note Actors at your current location, to help you remember areas to work on back in the editor. You use the dn
console command (for Drop Note), followed by the string you want to assign to the note.
For example:
dn fix lighting here
Will create a Note Actor with your player's current location and rotation, with the text fix lighting here.
Ending PIE
When the user hits Escape in the PIE window (or types quit
in the PIE console), the PIE window will close.
PIE Vs. Standalone
Here are some of the main differences between a game running in PIE and a game running standalone on the PC.
Garbage collection
When GIsEditor is set, garbage collection uses the old Serialization based method, instead of the new realtime GC method. See the GarbageCollection document for more information on the differences.
Async loading, level streaming
PIE does not handle level streaming. It loads all of the sublevels into memory.
Texture streaming, however, is performed in PIE.
Load flags
The load flags and functions (RF_LoadForClient, NeedsLoadForClient()), that specify to only load components and other objects in the editor, will act differently. Since GIsEditor is true, different components may be around in the PIE world than in a standalone world.
Kismet
Kismet has a setting to disable links for PIE only.
This was used in Gears of War to restrict teleporting the player to the level start (due to streaming between P maps in Gears, the PlayerStart actor wasn't really used for anything, and a teleport action was used). The teleport action would conflict with the Play From Here functionality, so the teleport action is disabled in PIE (orangle link color).
Performance
Performance testing should probably not be done in PIE as the game will definitely run slower. Not only is the editor still running and ticking away, and processing messages, etc, but any code that is disabled with "if (GIsEditor)" to speedup gameplay (because of validation that isn't needed at runtime, or whatever) will now be enabled. Usually such code has no side effects, it's just going to be slower.
Packages
Modifications to content in the editor will be reflected in the PIE world, even if the package has not been saved before running PIE. Similarly, when making level changes, the PIE world will reflect them, so if you don't like the changes, you can lose them by not saving the map in the editor (PIE saves the map to a temporary level file in the Autosaves directory).
Important!
You are viewing documentation for the Unreal Development Kit (UDK).
If you are looking for the Unreal Engine 4 documentation, please visit the Unreal Engine 4 Documentation site.