Packaged Project Throws an Error

Hi,

I am just getting into c++ and unreal engine so I may be doing something wrong.

Whenever I try to package the project and launch the packaged version it throws an error. I am almost definitely certain that it is related to c++ because if I do the same with blueprints it launches without any problem. The project can be played inside the editor and no error is thrown. The code is only a single function for scrolling up

h.

// Fill out your copyright notice in the Description page of Project Settings.

#pragma once

#include "Kismet/BlueprintFunctionLibrary.h"
#include "PlayerMovementLib.generated.h"

/**
 * 
 */
UCLASS()
class THECOLONY_API UPlayerMovementLib : public UBlueprintFunctionLibrary
{
	GENERATED_BODY()
public:	
	//Increase the height value
	UFUNCTION(BlueprintCallable, Category = "TopDownCameraControl")
		static int32 IncreaseHeight(int32 CurrentHeight);
}

.cpp

// Fill out your copyright notice in the Description page of Project Settings.

#include "TheColony.h"
#include "PlayerMovementLib.h"

int32 UPlayerMovementLib::IncreaseHeight(int32 CurrentHeight)
{
	int32 ClampedHeight = CurrentHeight;
	ClampedHeight++;
	//Set higher Boundary
	if (CurrentHeight >= 13)
	{
		ClampedHeight = 13;
	}
	return ClampedHeight;
}

The blueprint

The error

The project compile fine in visual studio and packages fine from the UEEditor. I can successfully launch the game from visual studio without any error in the following build configurations: DebugGame and Development

Might be a long shot, but have you set all your default values in the project settings? E.g. default map, gamemode, controller etc.?

I’ve seen some cases where the Editor/VS runs fine but packaged projects crash when these weren’t set.

I thought I have set everything, now that you told me there is a drop down menu with one single option Global Default Server Game Mode that had been left blank, after I have set it and rebuilt it it worked. Thank you very much, make your comment as an answer so as to mark the question as it solved

Glad you got it working - I remember that exact setting was the cause for my crash as well :slight_smile: