Hey All.
My project has been working without any problems till that i decided to restart unreal engine.
Now i cant even open my project.
Any Suggestions?
Access violation - code c0000005 (first/second chance not available)
UE4Editor_Engine!UEngine::AddOnScreenDebugMessage() + 4 bytes [d:\buildfarm\buildmachine_++depot+ue4-releases+4.7\engine\source\runtime\engine\private\unrealengine.cpp:6141]
UE4Editor_Prison_4522!AFPSGameMode::AFPSGameMode() + 287 bytes [d:\projects\unreal\prison\source\prison\fpsgamemode.cpp:16]
UE4Editor_CoreUObject!UClass::CreateDefaultObject() + 435 bytes [d:\buildfarm\buildmachine_++depot+ue4-releases+4.7\engine\source\runtime\coreuobject\private\uobject\class.cpp:2506]
UE4Editor_CoreUObject!UObjectLoadAllCompiledInDefaultProperties() + 805 bytes [d:\buildfarm\buildmachine_++depot+ue4-releases+4.7\engine\source\runtime\coreuobject\private\uobject\uobjectbase.cpp:739]
UE4Editor_CoreUObject!ProcessNewlyLoadedUObjects() + 146 bytes [d:\buildfarm\buildmachine_++depot+ue4-releases+4.7\engine\source\runtime\coreuobject\private\uobject\uobjectbase.cpp:815]
UE4Editor_CoreUObject!TBaseStaticDelegateInstance::ExecuteIfSafe() + 7 bytes [d:\buildfarm\buildmachine_++depot+ue4-releases+4.7\engine\source\runtime\core\public\delegates\delegateinstancesimpl_variadics.inl:921]
UE4Editor_Core!TBaseMulticastDelegate::Broadcast() + 149 bytes [d:\buildfarm\buildmachine_++depot+ue4-releases+4.7\engine\source\runtime\core\public\delegates\delegatesignatureimpl_variadics.inl:1030]
UE4Editor_Core!FModuleManager::LoadModuleWithFailureReason() + 2194 bytes [d:\buildfarm\buildmachine_++depot+ue4-releases+4.7\engine\source\runtime\core\private\modules\modulemanager.cpp:359]
UE4Editor_Projects!FModuleDescriptor::LoadModulesForPhase() + 784 bytes [d:\buildfarm\buildmachine_++depot+ue4-releases+4.7\engine\source\runtime\projects\private\moduledescriptor.cpp:350]
UE4Editor_Projects!FProjectManager::LoadModulesForProject() + 581 bytes [d:\buildfarm\buildmachine_++depot+ue4-releases+4.7\engine\source\runtime\projects\private\projectmanager.cpp:53]
UE4Editor!FEngineLoop::LoadStartupModules() + 705 bytes [d:\buildfarm\buildmachine_++depot+ue4-releases+4.7\engine\source\runtime\launch\private\launchengineloop.cpp:1863]
UE4Editor!FEngineLoop::PreInit() + 11141 bytes [d:\buildfarm\buildmachine_++depot+ue4-releases+4.7\engine\source\runtime\launch\private\launchengineloop.cpp:1400]
UE4Editor!GuardedMain() + 251 bytes [d:\buildfarm\buildmachine_++depot+ue4-releases+4.7\engine\source\runtime\launch\private\launch.cpp:110]
UE4Editor!GuardedMainWrapper() + 26 bytes [d:\buildfarm\buildmachine_++depot+ue4-releases+4.7\engine\source\runtime\launch\private\windows\launchwindows.cpp:126]
UE4Editor!WinMain() + 249 bytes [d:\buildfarm\buildmachine_++depot+ue4-releases+4.7\engine\source\runtime\launch\private\windows\launchwindows.cpp:202]
UE4Editor!__tmainCRTStartup() + 329 bytes [f:\dd\vctools\crt\crtw32\dllstuff\crtexe.c:618]
CODE:
FPSGameMode.h
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "GameFramework/GameMode.h"
#include "FPSGameMode.generated.h"
/**
*
*/
UCLASS()
class PRISON_API AFPSGameMode : public AGameMode
{
GENERATED_UCLASS_BODY()
//AFPSGameMode::AFPSGameMode(const class FObjectInitializer& PCIP);
virtual void StartPlay() override; // Note that engine version 4.3 changed this method's name to StartPlay(), because of this engine versions before 4.3, or older tutorials, use BeginPlay()
};
FPSGameMode.cpp
// Fill out your copyright notice in the Description page of Project Settings.
#include "Prison.h"
#include "FPSGameMode.h"
#include "Engine.h" //for version 4.4+
AFPSGameMode::AFPSGameMode(const class FObjectInitializer& PCIP): Super(PCIP)
{
static ConstructorHelpers::FObjectFinder<UBlueprint> MyBlueprintObject(TEXT("Blueprint'/Game/Blueprints/BP_FPSCharacter.BP_FPSCharacter_C'"));
if (PlayerPawnObject.Class != NULL)
{
DefaultPawnClass = PlayerPawnObject.Class;
}
}
void AFPSGameMode::StartPlay()
{
Super::StartPlay();
StartMatch();
}
FPSCharacter.h
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "GameFramework/Character.h"
#include "FPSCharacter.generated.h"
UCLASS()
class PRISON_API AFPSCharacter : public ACharacter
{
GENERATED_BODY()
public:
// Sets default values for this character's properties
AFPSCharacter();
// Called when the game starts or when spawned
virtual void BeginPlay() override;
// Called every frame
virtual void Tick( float DeltaSeconds ) override;
// Called to bind functionality to input
virtual void SetupPlayerInputComponent(class UInputComponent* InputComponent) override;
//handles moving forward/backward
UFUNCTION()
void MoveForward(float Val);
//handles strafing
UFUNCTION()
void MoveRight(float Val);
//sets jump flag when key is pressed
UFUNCTION()
void OnStartJump();
//clears jump flag when key is released
UFUNCTION()
void OnStopJump();
public:
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = Camera)
UCameraComponent* FirstPersonCameraComponent;
AFPSCharacter(const FObjectInitializer& ObjectInitializer);
/** Pawn mesh: 1st person view (arms; seen only by self) */
//UPROPERTY(VisibleDefaultsOnly, Category = Mesh)
// USkeletalMeshComponent* FirstPersonMesh;
protected:
//virtual void SetupPlayerInputComponent(class UInputComponent* InputComponent) override;
};
FPSCharacter.cpp
// Fill out your copyright notice in the Description page of Project Settings.
#include "Prison.h"
#include "FPSCharacter.h"
// Sets default values
AFPSCharacter::AFPSCharacter()
{
// Set this character to call Tick() every frame. You can turn this off to improve performance if you don't need it.
PrimaryActorTick.bCanEverTick = true;
}
// Called when the game starts or when spawned
void AFPSCharacter::BeginPlay()
{
Super::BeginPlay();
}
// Called every frame
void AFPSCharacter::Tick( float DeltaTime )
{
Super::Tick( DeltaTime );
}
// Called to bind functionality to input
void AFPSCharacter::SetupPlayerInputComponent(class UInputComponent* InputComponent)
{
Super::SetupPlayerInputComponent(InputComponent);
// set up gameplay key bindings
InputComponent->BindAxis("MoveForward", this, &AFPSCharacter::MoveForward);
InputComponent->BindAxis("MoveRight", this, &AFPSCharacter::MoveRight);
InputComponent->BindAxis("Turn", this, &AFPSCharacter::AddControllerYawInput);
InputComponent->BindAxis("LookUp", this, &AFPSCharacter::AddControllerPitchInput);
InputComponent->BindAction("Jump", IE_Pressed, this, &AFPSCharacter::OnStartJump);
InputComponent->BindAction("Jump", IE_Released, this, &AFPSCharacter::OnStopJump);
}
void AFPSCharacter::MoveForward(float Value)
{
if ((Controller != NULL) && (Value != 0.0f))
{
// find out which way is forward
FRotator Rotation = Controller->GetControlRotation();
// Limit pitch when walking or falling
if (GetCharacterMovement()->IsMovingOnGround() || GetCharacterMovement()->IsFalling())
{
Rotation.Pitch = 0.0f;
}
// add movement in that direction
const FVector Direction = FRotationMatrix(Rotation).GetScaledAxis(EAxis::X);
AddMovementInput(Direction, Value);
}
}
void AFPSCharacter::MoveRight(float Value)
{
if ((Controller != NULL) && (Value != 0.0f))
{
// find out which way is right
const FRotator Rotation = Controller->GetControlRotation();
const FVector Direction = FRotationMatrix(Rotation).GetScaledAxis(EAxis::Y);
// add movement in that direction
AddMovementInput(Direction, Value);
}
}
void AFPSCharacter::OnStartJump()
{
bPressedJump = true;
}
void AFPSCharacter::OnStopJump()
{
bPressedJump = false;
}
AFPSCharacter::AFPSCharacter(const FObjectInitializer& ObjectInitializer) : Super(ObjectInitializer)
{
// Create a CameraComponent
FirstPersonCameraComponent = ObjectInitializer.CreateDefaultSubobject<UCameraComponent>(this, TEXT("FirstPersonCameraComponent"));
FirstPersonCameraComponent->AttachParent = GetCapsuleComponent();
// Position the camera a bit above the eyes
FirstPersonCameraComponent->RelativeLocation = FVector(0, 0, 50.0f + BaseEyeHeight);
// Allow the pawn to control rotation.
FirstPersonCameraComponent->bUsePawnControlRotation = true;
}