AttachRootComponentToActor access violation when opening project directly through the editor

I’m currently working on a project using Unreal v4.10 preview 4.

When opening the project directly via the editor, I am hit with an access violation on this line when I attempt to play:

_tile->AttachRootComponentToActor(_main, NAME_None, EAttachLocation::KeepWorldPosition);

However, frustratingly, I cannot debug or evaluate which part of the line of code is causing this issue, as running the project from Visual Studio (build configuration is DebugGame) or attempting to debug it does not re-produce this error and the game loads just fine. Does anyone know why the game can run from VS or be debugged, but crash when opening the project from the editor? Is this a bug? It is the first time I have encountered this issue so perhaps it is something caused by preview 4? The line is pratically unchanged althroughout development, starting from v4.9.1.


I have adjusted the line to this:

if (_tile)
    if (_main)
		_tile->AttachRootComponentToActor(_main, NAME_None, EAttachLocation::KeepWorldPosition);
	else Helper::DebugFStringLog("_MAIN IS NULL: " + _tilePos.ToString());
else Helper::DebugFStringLog("TILE VARIABLE IS NULL: " + _tilePos.ToString());

It seems the ‘_main’ variable is null. Which is wierd, as, again, _main is initialised if I run the project from VS, and I can see in the world hierarchy window that the level tiles are parented to the ‘_main’ object.

_main is an actor child class I called “AEmptyActor.” I spawn this first before anything else is created and attach the level tiles to it. It essentially acts as a dummy object I can attach things to.

… anyone?