I have followed these video tutorials (- YouTube), for getting started with coding in C++ for UE4.
The following dialog box with this message shows up when I use the DebugGame Editor solution configuration, in VS2013:
Default Property warnings and errors:![alt text][1]
Error: CDO Constructor: Failed to find
Engine/Content/Slate/Fonts/RobotoDistanceField
The editor still loads up the project though, I am even allowed to build the level of such, but when I hit play or simulate, VS2013 throws up an Unhandled exception as informed to me by VS2013 here:
Unhandled exception at 0x000007FEDC1DE90D (UE4Editor-CodedThirdPersonTest-Win64-DebugGame.dll) in UE4Editor.exe: 0xC0000005: Access violation reading location 0x0000000000000440
If I load up the project from the launcher, I do not get the dialog box, that says that it failed to find the font I am using, I can even build the project without crashes as well, but when I hit play or simulate, the editor crashes and gives a crash report dialog box, with the following message in the CallStack:
!Id:db65fb41d3d4038b7a249124801d13da
Access violation - code c0000005 (first/second not available)
Fatal error!
UE4Editor_CodedThirdPersonTest_7476!ACodedThirdPersonTestHUD::DrawHUD() + 294 bytes [c:\users\\documents\unreal projects\codedthirdpersontest\source\codedthirdpersontest\private\codedthirdpersontesthud.cpp:36]
UE4Editor_Engine + 4278977 bytes
UE4Editor_Engine + 3434988 bytes
UE4Editor_Engine + 8422933 bytes
UE4Editor_UnrealEd + 1816980 bytes
UE4Editor_UnrealEd + 5925286 bytes
UE4Editor!FEngineLoop::Tick() + 3294 bytes [d:\buildfarm\buildmachine_++depot+ue4-releases+4.4\engine\source\runtime\launch\private\launchengineloop.cpp:2098]
UE4Editor!GuardedMain() + 476 bytes [d:\buildfarm\buildmachine_++depot+ue4-releases+4.4\engine\source\runtime\launch\private\launch.cpp:133]
UE4Editor!GuardedMainWrapper() + 26 bytes [d:\buildfarm\buildmachine_++depot+ue4-releases+4.4\engine\source\runtime\launch\private\windows\launchwindows.cpp:125]
UE4Editor!WinMain() + 249 bytes [d:\buildfarm\buildmachine_++depot+ue4-releases+4.4\engine\source\runtime\launch\private\windows\launchwindows.cpp:201]
UE4Editor!__tmainCRTStartup() + 329 bytes [f:\dd\vctools\crt\crtw32\dllstuff\crtexe.c:618]
This project was created with version 4.4.3, and version 4.4.3 is used to load the project from the launcher.
I have also loaded other projects of mine and none of them get this crash error.
Edit: As of today, the 19/10/2014, I have also created a new third person code project, built it, and that runs just fine, no errors, no crashes, which could very well mean that there could be a fault with my code, or VS2013, a link to a zip of the source is here: https://dl.dropboxusercontent.com/u//Source.zip
I was not getting this crash before adding text to the HUD, the base HUD class did not cause any crashes or compilation errors, but trying to draw text to the HUD canvas, did cause the popup, that occurs when I ran the DebugGame Editor solution configuration (failed to find), then trying to run or simulate the default level, with this gamemode, causes the crash as detailed above.
Edit as of 20/10/2014: I have managed to narrow down the error to this if statement, not the code within the if statement, but the line MyGameMode->GetCurrentGameState()
at the start of the if statement, throws up the access violated error (when the solution is built, with this line commented out, I can play the game in the editor, no crashes).
if (/*MyGameMode->GetCurrentGameState() ==*/ ACodedThirdPersonTestGameMode::ECodedThirdPersonTestPlayState::EGameOver)
{
// Create a varible for storing the size of printing Game Over
FVector2D GameOverSize;
GetTextSize(TEXT("GAME OVER"), GameOverSize.X, GameOverSize.Y, HUDFont);
DrawText(TEXT("GAME OVER"), FColor::White, (ScreenDimensions.X - GameOverSize.X) / 2.0f, (ScreenDimensions.Y - GameOverSize.Y) / 2.0f, HUDFont);
}
I have even changed the Enum, from being part of a namespace, to being a UENUM, of the ACodedThirdPersonTestGameMode class declaration, in the header file of ACodedThirdPersonTestGameMode, as shown below:
UCLASS(minimalapi)
class ACodedThirdPersonTestGameMode : public AGameMode
{
GENERATED_UCLASS_BODY()
virtual void Tick(float DeltaSeconds) override;
// This is the enum to store the current state of gameplay
UENUM(BlueprintType)
enum ECodedThirdPersonTestPlayState
{
EPlaying,
EGameOver,
EUnknown,
};
Edit as of 3 hours after the first edit on 20/10/2014:
I have changed my enum to be assigned a value on declaration as so:
ECodedThirdPersonTestPlayState CurrentGameState = ECodedThirdPersonTestPlayState::EPlaying;
(This is in the CodedThirdPersonTestGameMode.h file)
I have also edited the GetCurrentStateFunction
() to this, to try and make sure it is not a null pointer:
(It is declared in the header file as: ECodedThirdPersonTestPlayState GetCurrentGameState();
)
ACodedThirdPersonTestGameMode::ECodedThirdPersonTestPlayState ACodedThirdPersonTestGameMode::GetCurrentGameState()
{
if (!CurrentGameState)
{
return ACodedThirdPersonTestGameMode::ECodedThirdPersonTestPlayState::EUnknown;
}
else
{
return CurrentGameState;
}
}
Doing both of these changes, still cause the access violation error to occur once again.
Edit as of 21/10/2014: I have tried to get the value on the enum,so that I can see it in debug mode, by making the variable public, this is what is shown now:
Even though I assign a value to the CurrentGameState
variable, in the ThirdPersonTestGameMode.cpp
file, it is still seen as having a value of ‘???’, after that breakpoint, continuing on still causes the same errors to occur.