[Plugin] Issue when running standalone

Hi everyone!

I am currently developing a plugin for UE4 and it has been running absolutely fine in editor, I can run around and then alt+f1 to unlock the mouse and use the plugin.

However, when I try running the game as a standalone (from play dropdown, select standalone instead of viewport), the game opens as a standalone and I can look around with the mouse with absolutely no problem. But when I touch any key on the keyboard. The game crashes and I get this error:

Access violation - code c0000005 (first/second chance not available)

UE4Editor_MainFrame + 263965 bytes
UE4Editor_MainFrame + 173590 bytes
UE4Editor_Slate + 567786 bytes
UE4Editor_Slate + 815973 bytes
UE4Editor_Slate + 751747 bytes
UE4Editor_Core + 2505572 bytes
UE4Editor_Core + 2450075 bytes
UE4Editor_Core + 2510857 bytes
UE4Editor_Core + 2438450 bytes
user32 + 105425 bytes
user32 + 104666 bytes
UE4Editor_Core + 3157702 bytes
UE4Editor!FEngineLoop::Tick() + 3106 bytes [d:\buildfarm\buildmachine_++depot+ue4-releases+4.5\engine\source\runtime\launch\private\launchengineloop.cpp:2111]
UE4Editor!GuardedMain() + 479 bytes [d:\buildfarm\buildmachine_++depot+ue4-releases+4.5\engine\source\runtime\launch\private\launch.cpp:133]
UE4Editor!GuardedMainWrapper() + 26 bytes [d:\buildfarm\buildmachine_++depot+ue4-releases+4.5\engine\source\runtime\launch\private\windows\launchwindows.cpp:125]
UE4Editor!WinMain() + 249 bytes [d:\buildfarm\buildmachine_++depot+ue4-releases+4.5\engine\source\runtime\launch\private\windows\launchwindows.cpp:201]
UE4Editor!__tmainCRTStartup() + 329 bytes [f:\dd\vctools\crt\crtw32\dllstuff\crtexe.c:618]

Does anyone have any idea why this might be the case?
Some additional details include that the plugin window does not open with the standalone game, the uplugin I have specified the module as “Type”: “Developer”, I did try “Runtime” but this didn’t work either.

Thanks for any reply

Could it be that you are using stuff that is only meant for the editor? #if WITH_EDITORONLY_DATA is used in such cases. It could also be the loading phase, try setting it to PreDefault.

Could you run it in debug mode using source from GitHub? this way you will get a better trace of the crash.

Hi Moss,

Thanks for the reply, I think this was probably right, I realized I was including “UnrealEd” Module which quite obviously a editor module. Even though I removed this (think through iteration of the plugin it became redundant), another module called “LevelEditor” is including “UnrealEd”.

In terms of plugin code, I am creating a new animation graph node that depends from data from an external plugin, and this plugin is drawn in slate (that does not seem to draw in standalone mode). Below is a list of includes under #if WITH_EDITOR, can you tell off the top of your head which one might be causing the issue/ might need to be included in place of “LevelEditor”.

#include “EngineDefines.h”

#include “Slate.h”
#include “EditorStyle.h”

#include “EditorComponents.h”
#include “EditorReimportHandler.h”
#include “TexAlignTools.h”

#include “TickableEditorObject.h”

#include “UnrealEdClasses.h”

#include “Editor.h”

#include “EditorViewportClient.h”
#include “LevelEditorViewport.h”

#include “EditorModeRegistry.h”
#include “EditorModes.h”

#include “MRUList.h”
#include “Projects.h”


Also, forgot to include this screenshot, I changed the LoadingPhase to PreDefault and ran with the github source code. It gave me this error. It appears that the error occurs (as I had already guessed) with a keyboard press. For some reason, Slate looks as if it is trying to process the keyboard press when it has no need to.