Thesbu
(Thesbu)
March 27, 2015, 4:36pm
1
When basing a Blueprint on a custom HUD-Class like the one in A new, community-hosted Unreal Engine Wiki - Announcements - Unreal Engine Forums the Editor crashes when trying to enter the Blueprint-Editor.
Access violation - code c0000005 (first/second chance not available)
UE4Editor_MyProject8_8245!AMainMenuHUD::PostInitializeComponents() + 456 bytes [c:\users\clemens\documents\unreal projects\myproject8\source\myproject8\mainmenuhud.cpp:19]
UE4Editor_Engine!AActor::PostActorConstruction() …
Hello Thesbu,
I have a few questions for you that will help narrow down what issue it is that you are experiencing.
Quick questions:
What version of the engine are you using?
Can you reproduce this in a clean project?
If so, could you provide a detailed set up steps to reproduce this issue on our end?
Could you provide a screen shot of any blueprints that may be involved with this issue?
Are you receiving any errors?
If so, could you provide them?
Thesbu
(Thesbu)
March 28, 2015, 3:25pm
3
Hi Rudy,
I. 4.7.2
II. Yes
III.I Create Code like in the linked Wiki-Tutorial and make it working (e.g. Set Game Mode)
III.II Create a new Blueprint based on the custom C+±HUD
III.III Try Editing the newly created Blueprint
III.IV Editor Crash while loading the Blueprint-Editor
IV. No Blueprints existing (Clean Project only with C+±Classes)
V. + VI. See End of original Posting
Hello Thesbu,
I followed the tutorial that you were using and I was unable to reproduce the crash that you mentioned. Could you provide the code that was used for the blueprint that you are having issues with?
Thesbu
(Thesbu)
March 30, 2015, 6:25pm
5
Hi Rudy,
#include "MyProject11.h"
#include "MyHUD.h"
#include "SMyCompoundWidget.h"
AMyHUD::AMyHUD(const FObjectInitializer& ObjectInitializer) : Super(ObjectInitializer)
{
}
void AMyHUD::PostInitializeComponents()
{
Super::PostInitializeComponents();
SAssignNew(Widget, SMyCompoundWidget).MyHUD(this);
if (GEngine->IsValidLowLevel())
{ GEngine->GameViewport->AddViewportWidgetContent(SNew(SWeakWidget).PossiblyNullContent(Widget.ToSharedRef()));
}
}
As you can see the differences are only:
The Project Name
The ClassName for the HUD-Class + CompoundWidget-Class
The Name of the Widget-Variable in the Hud-Class
The Name of the Slate-Parameter
Nothing of that should make a real difference. The Code compiles and works.
If you would like me to provide something else, I will, but, as said, my Code is the same (only Names differ) as in the Tutorial. I made that sure a couple of times now.
Thesbu
(Thesbu)
March 31, 2015, 12:30pm
6
Hi Rudy,
I now solved the Problem by including a null-Check for the GENIGNE-GameViewport:
void AMyHUD::PostInitializeComponents()
{
Super::PostInitializeComponents();
SAssignNew(Widget, SMyCompoundWidget).MyHUDl(this);
if (GEngine->IsValidLowLevel())
{
if (GEngine->GameViewport != nullptr)
{ GEngine->GameViewport->AddViewportWidgetContent(SNew(SWeakWidget).PossiblyNullContent(Widget.ToSharedRef()));
}
}
}
But there remains the Question, why you could not reproduce the Bug!
Maybe the Tutorial should be extended by null-checks for GEngine + GEngine->GameViewport.
Hello Thesbu,
I am using version 4.7.3 of the engine. This may have made the difference in this case. However, I am happy to hear that your issue has been resolved. I will be sure to make a suggestion to the docs team. Thank you for your time and information.
Make it a great day.