x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Office Holiday

Epic Games' offices will be on holiday from June 22nd to July 7th. During this period support will be limited. Our offices will reopen on Monday, July 8th. 

Game works in editor, and packaging succeeds, but opening the exported package fails

Hi,

I am trying to package my game so that it can be run outside the editor, however I can't get it to work. I can compile my game and it runs perfectly within the engine, I then package it and it succeeds, but then I open it and it doesn't even get to the level it just pops of a Fatal Error message. It just says EXCEPTION_ACCESS_VIOLATION and does not tell me where. Again, this works in the editor??

It seems to fail around the EnemyCharacter class so here is the whole file, sorry for their length :(

header:

 #pragma once
 
 #include "CoreMinimal.h"
 #include "GameCharacter.h"
 #include "UObject/NoExportTypes.h"
 #include "Engine/DataAsset.h"
 #include "EnemyCharacter.generated.h"
 
 class UEnemyAnimInstance;
 class AEnemyAI;
 class UVisionComponent;
 class UDistanceToControllerComponent;
 class UHealthComponent;
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 // UEnemyBlackboard Class
 
 /**
 *    Blackboard class representing the values associated with  
 */
 USTRUCT()
 struct FEnemyBlackboard
 {
 
     GENERATED_USTRUCT_BODY()
 
     /** Default Constructor */
     FEnemyBlackboard() {};
 
     /** Boolean value indicating whether the NPC is currently in cover */
     UPROPERTY()
     bool bIsInCover = false;
 
     /** Boolean value indicating whether the NPC should attack */
     UPROPERTY()
     bool bShouldAttack = true;
 };
 
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 //  AEnemyCharacter class
 
 /**
 *   Class controlling the representation of an NPC Character
 *    whithin the game
 */
 UCLASS()
 class TMO_API AEnemyCharacter : public AGameCharacter
 {
     GENERATED_BODY()
 
 public:
     /** Default constructor for the AEnemyCharacter class */
     AEnemyCharacter();
 
     /** VisionComponent */
     UPROPERTY()
     UVisionComponent* Vision;
 
     /** DistanceCheck Component */
     UPROPERTY()
     UDistanceToControllerComponent* DistanceChecker;
 
 protected:
     /** Animation Controller for the NPC */
     UPROPERTY()
     UEnemyAnimInstance* AnimController;
 
     /** AIController which controls the MPC character */
     UPROPERTY()
     AEnemyAI* CharacterAIController;
 
     /**
     *    Variable declaring if the NPC will be declared in blueprints (true) or randomly
     *    generated (false)
     */
     UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = NPCSettings)
     bool bIsDeclaredInBlueprints = false;
 
     /**
     *    Variable delcaring the max speed of the NPC within the game, this value
     *    will be overwritten if IsDeclaredBlueprints is not set to false (unchecked)
     */
     UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = NPCSettings)
     float MaxSpeed = 400.f;
 
 protected:
 
     /** Function called after the constructor but before play begins */
     virtual void BeginPlay() override;
 
 public:
 
     /** Function called to setup the blackboard component */
     virtual FEnemyBlackboard* SetupBlackboardComponent();
 
     /** Function called to warn the squad */
     virtual void WarnSquad();
 
     /** Function called to alter the speed of the character by a fraction of the max speed*/
     virtual void ChangeSpeedToFraction(float Fraction);
 
     /** Function called to melee attack the opponent */
     virtual void MeleeAttackOpponent();
 
     /** Function called by VisionComponent when player spotted */
     virtual void PlayerSearchResult();
 
     /** Function called when the distance component returns true */
     void SquadRadiusEntered(bool isGreaterThan);
 
     /** Function called to activate the DistanceToControllerComponent */
     void SetupStandardDistanceComponent();
 
     /** Function called to activate the VisionComponent */
     void SetupStandardVisionComponent();
 
     /** Function called to deactivate the DistanceToControllerComponent */
     void DeactivateDistanceComponent();
 
     /** Function called to deactivate the VisionComponent */
     void DeactivateVisionComponent();
 
 public:
     /** Getter for the AnimController instance */
     FORCEINLINE UEnemyAnimInstance* GetAnimController() const { return AnimController; }
 };
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////


cpp file

 #include "EnemyCharacter.h"
 #include "EnemyAI.h"
 #include "EnemyAnimInstance.h"
 #include "Engine.h"
 #include "TMO.h"
 #include "Components/CapsuleComponent.h"
 #include "VisionComponent.h"
 #include "NPCBlackboard.h"
 #include "SquadNPCBlackboard.h"
 #include "HealthComponent.h"
 #include "DistanceToControllerComponent.h"
 #include "Runtime/Engine/Classes/Kismet/GameplayStatics.h"
 #include "Runtime/Engine/Classes/GameFramework/Controller.h"
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 //  AEnemyCharacter class
 
 /** Default constructor for the AEnemyCharacter class */
 AEnemyCharacter::AEnemyCharacter()
     : Super()
 {
 
     // Set size for collision capsule
     GetCapsuleComponent()->InitCapsuleSize(42.f, 96.0f);
     RootComponent = GetCapsuleComponent();
 
      // 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;
 
     // Setup DistanceChecker for search purposes
     DistanceChecker = CreateDefaultSubobject<UDistanceToControllerComponent>(TEXT("DistanceCheckComponent"));
     AddOwnedComponent(DistanceChecker);
 
     // Setup VisionComponent to search for the player
     Vision = CreateDefaultSubobject<UVisionComponent>(TEXT("VisionComponent"));
     AddOwnedComponent(Vision);
 
     UE_LOG(NPCCharacterLog, Log, TEXT("Finsihing Enemy Character's Constructor"));
 }
 
 /** Function called to setup the blackboard component */
 FEnemyBlackboard* AEnemyCharacter::SetupBlackboardComponent()
 {
     return new FEnemyBlackboard();
 }
 
 /** Function called to warn the squad */
 void AEnemyCharacter::WarnSquad()
 {
     AnimController->PerformWarnSquad();
     AnimController->FunctionToCall.BindUObject(CharacterAIController, &AEnemyAI::IndicatePlayerSpotted);
 }
 
 /** Function called to alter the speed of the character */
 void AEnemyCharacter::ChangeSpeedToFraction(float Fraction)
 {
     AnimController->SetSpeed(MaxSpeed * Fraction);
     GetCharacterMovement()->MaxWalkSpeed = MaxSpeed * Fraction;
 }
 
 /** Function called by VisionComponent when player spotted */
 void AEnemyCharacter::PlayerSearchResult()
 {
     DeactivateVisionComponent();
     CharacterAIController->PlayerSpotted();
 }
 
 /** Called when the game starts or when spawned */
 void AEnemyCharacter::BeginPlay()
 {
     Super::BeginPlay();
 
     #if !UE_BUILD_SHIPPING
         UE_LOG(NPCCharacterLog, Log, TEXT("Calling Enemy Character's C++ BeginPlay"));
     #endif // DEBUG
 
     GetCharacterMovement()->MaxWalkSpeed = MaxSpeed;
 
     CharacterAIController = Cast<AEnemyAI>(GetController());
 
     // Setup AnimController
     AnimController = Cast<UEnemyAnimInstance>(GetMesh()->GetAnimInstance());
     AnimController->FunctionToCall.BindUObject(CharacterAIController, &AEnemyAI::NextTask);
 
     Vision->PrimaryComponentTick.SetTickFunctionEnable(false);
 
     SetupStandardDistanceComponent();
 
     GetMesh()->SetCollisionResponseToChannel(ECC_Camera, ECR_Ignore);
     UE_LOG(NPCCharacterLog, Log, TEXT("Finishing BeginPlay"));
 
 }
 
 /** Function called to melee attack the opponent */
 void AEnemyCharacter::MeleeAttackOpponent()
 {
     AnimController->PerformMeleeAttack();
     CharacterAIController->ApplyDamageToPlayer(50);
 }
 
 /** Function called to activate the DistanceToControllerComponent */
 void AEnemyCharacter::SetupStandardDistanceComponent()
 {
     if (DistanceChecker)
     {
         DistanceChecker->Activate();
         DistanceChecker->SetComponentTickEnabled(true);
         DistanceChecker->FunctionToCall.BindUObject(this, &AEnemyCharacter::SquadRadiusEntered);
     }
 }
 
 /** Function called to deactivate the DistanceToControllerComponent */
 void AEnemyCharacter::DeactivateDistanceComponent()
 {
     if (DistanceChecker)
     {
         DistanceChecker->PrimaryComponentTick.SetTickFunctionEnable(false);
         DistanceChecker->Deactivate();
     }
 }
 
 /** Function called to activate the VisionComponent */
 void AEnemyCharacter::SetupStandardVisionComponent()
 {
     if (Vision)
     {
         Vision->Activate();
         Vision->SetComponentTickEnabled(true);
         Vision->FunctionToCall.BindUObject(this, &AEnemyCharacter::PlayerSearchResult);
     }
 }
 
 /** Function called to destroy the VisionComponent */
 void AEnemyCharacter::DeactivateVisionComponent()
 {
     if (Vision)
     {
         Vision->PrimaryComponentTick.SetTickFunctionEnable(false);
         Vision->Deactivate();
     }
 }
 
 /** Function called when the distance component returns true */
 void AEnemyCharacter::SquadRadiusEntered(bool isGreaterThan )
 {
     DeactivateDistanceComponent();
     CharacterAIController->AttachControllerToSquad();
     SetupStandardVisionComponent();
 }
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

Is there any other files I can look at to attempt to find the problem? I have been working on this problem for hours :(

Log for the Packaged Game link text

Crash log from the Crashes folder link text

Thanks for any and all help

Product Version: UE 4.16
Tags:
tmo.log (19.0 kB)
tmo.log (16.1 kB)
more ▼

asked Sep 09 '17 at 06:09 PM in Packaging & Deployment

avatar image

MechaFarin
42 3 6 7

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

0 answers: sort voted first
Be the first one to answer this question
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question