Editor crash on "Unhandled blueprint type"

Hi

I’m trying to make a simple game to learn the ropes with UE4, but I ran into a weird problem when working with C++ and Blueprints.

The goal of the game is to just collect the number of coins required for each level. Here is the code for my AGameMode sub class:

Header

//ABombQuestGameMode.h
UCLASS()
class BOMBQUEST_API ABombQuestGameMode : public AGameMode
{
	GENERATED_UCLASS_BODY()

	/** The number of coins the player has currently collected*/
	uint32 coins;

	/** The player's current level*/
	uint32 level;

	/** The number of levels in the game*/
	uint32 numLevels;

	/** A list of coins required for each level to move on*/
	TArray<uint32> goals;

	/** Initialize the game with an array of goals and number of levels*/
	UFUNCTION(BlueprintCallable, Category = "Game Progress")
	void setGameGoals(uint32 levCount, TArray<uint32>levGoals);

	/** Increments the coin counter. Returns true if the player leveled up*/
	UFUNCTION(BlueprintCallable, BlueprintNativeEvent, Category = "Game Progress")
	bool gotCoin();

	/** Returns the number of coins the player has collected so far*/
	UFUNCTION(BlueprintCallable, Category = "Game Progress")
	uint32 getCoins();

	/**Returns the player's current level*/
	UFUNCTION(BlueprintCallable, Category = "Game Progress")
	uint32 getLevel();

	/** Returns the number of coins needed for the current level*/
	UFUNCTION(BlueprintCallable, Category = "Game Progress")
	uint32 getCoinGoal();

};

Source

//ABombQuestGameMode.cpp
ABombQuestGameMode::ABombQuestGameMode(const class FPostConstructInitializeProperties& PCIP)
	: Super(PCIP)
{

}

void ABombQuestGameMode::setGameGoals(uint32 levCount, TArray<uint32>levGoals){
	goals = levGoals;
	numLevels = levCount;
}

bool ABombQuestGameMode::gotCoin_Implementation(){
	if (++coins >= goals[level]){
		level++;
		coins = 0;
		return true;
	}
	return false;
}

uint32 ABombQuestGameMode::getCoins(){
	return coins;
}

uint32 ABombQuestGameMode::getLevel(){
	return level;
}

uint32 ABombQuestGameMode::getCoinGoal(){
	return goals[level];
}

I don’t want to hard-code the number of levels or the coins required, I’d rather initialize these variables in Blueprints. So after the above code built successfully, I created a blueprint with the following construction script:

22299-bombprob.png

This is where it gets problematic. If you notice, the two parameters LevCount and LevGoals are showing up, but as soon as I hover my mouse over one of them, the editor crashes and Visual Studio gives the following output:

The thread 0x2930 has exited with code 0 (0x0).

[2014.11.27-02.27.17:781][308]LogEditorViewport: Clicking on Actor (LMB): StaticMeshActor (SM_AssetPlatform)

Ensure condition failed: false [File:D:\BuildFarm\buildmachine_++depot+UE4->Releases+4.5\Engine\Source\Editor\BlueprintGraph\Private\EdGraphSchema_K2.cpp] [Line: 2660]

Unhandled blueprint type (‘bad_type’), failed to find type description.

UE4Editor.exe has triggered a breakpoint.

The program ‘[6604] UE4Editor.exe’ has exited with code 0 (0x0).

At first I suspected that I was just using the TArray incorrectly and got rid of it so that the function would only have the one uint32 argument, but it still crashed with the exact same error.

This is on version 4.5.1

So what am I doing wrong here?

Thanks.

I’ll need to do some digging around to see if I can isolate this, but what happens if you change uint32 to int32 for those variables?

That completely fixed it… So does Blueprints not support unsigned integers or something?

At the moment, maybe it doesn’t. I’ll take a look and see if this is something I can implement easily and toss in a PR.

I had the same trouble, but removed all my references to uint32 and it still crashed, I have some int8’s too (it rejected byte during compilation), are those not allowed either? What’s the recommended byte type in UE?

edit: Sorry silly, I needed uint8 of course, that worked :slight_smile: