My UObject class doesn't show up in blueprint variables

Hey lovely Unreal Community.
I’m relatively new with C++ coding inside of Unreal. The past few days I tried many things to solve the problem with my class, without any solution. I created the following .cpp and .h files over the classic workflow in Unreal.

.h File

#pragma once

#include "CoreMinimal.h"
#include "UObject/NoExportTypes.h"
#include "ItemSettings.generated.h"

/**
 * 
 */
UCLASS(BlueprintType,Blueprintable)
class MYPROJECT_API UItemSettings : public UObject
{
	GENERATED_BODY()
	
private:
	FName id;
	FText name;
	bool allowed;
	int32 mincount;
	int32 maxcount;
	//AActor actor;
public:

	//UItemSettings();

	UFUNCTION(BlueprintCallable, Category = "Item Settings")
	FName getId();

	UFUNCTION(BlueprintCallable)
	FText getName();

	UFUNCTION(BlueprintCallable)
	bool isAllowed();

	UFUNCTION(BlueprintCallable)
	int32 getMinCount();

	UFUNCTION(BlueprintCallable)
	int32 getMaxCount();
	/*
	UFUNCTION(BlueprintPure)
	AActor getActor();
	*/
	UFUNCTION(BlueprintCallable)
	bool setAllowed(bool isAllowed);

	UFUNCTION(BlueprintCallable)
	int32 setMinCount(int32 count);

	UFUNCTION(BlueprintCallable)
	int32 setMaxCount(int32 count);
};

and the corresponding cpp file

#include "ItemSettings.h"

/*
UItemSettings::UItemSettings()
{
}
*/
FName UItemSettings::getId()
{
	return UItemSettings::id;
}

FText UItemSettings::getName()
{
	return UItemSettings::name;
}

bool UItemSettings::isAllowed()
{
	return UItemSettings::allowed;
}

int32 UItemSettings::getMinCount()
{
	return UItemSettings::mincount;
}

int32 UItemSettings::getMaxCount()
{
	return UItemSettings::maxcount;
}
/*
AActor UItemSettings::getActor()
{
	return UItemSettings::actor;
}
*/
bool UItemSettings::setAllowed(bool isAllowed)
{
	return UItemSettings::allowed;
}

int UItemSettings::setMinCount(int32 count)
{
	return UItemSettings::mincount;
}

int UItemSettings::setMaxCount(int32 count)
{
	return UItemSettings::maxcount;
}

As far as good, but now I wonder why Unreal doesn’t show me my class inside the variables dropdown in a Blueprint. I use Live Coding with Visual Studio Community 2022 and I restarted the engine multiple times. As far as my knowledge goes I should have done everything right or?

Side nodes:

  • I commented some things out, to check if there is just a problem with some variables or something like that.
  • The class itself doesn’t appear inside the Unreal content browser under the C++/Public folder, maybe here lays the problem or is it because it is a UObject?
    image
  • Visual Studio and Unreal don’t show any problems with my code.
  • I use Unreal Engine 5.3.2

Thank you in advance.

Did you create the cpp & header file via the Tools => New C++ Class => parent class UObject?

It should show up in engine


If you add pure files in your IDE it may not register in the engine.
The file needs to register in YourProjectName.vcxproj.filters in your intermediate folder.

Hey @3dRaven thanks for your response.

Yes I created those like you described. Ironically everything worked just fine for the AItemData class.

I took a look into the MyProjectName.vcxproj.filters. After checking all paths and filenames everything looked great so far.

Now to the good part, I found a solution.
I deactivated Live Coding now and recompiled the project from unreal.

image

After Unreal crashed and restarted I compiled again with success. Now my class is shown in the content browser and is accessible in my blueprints.

I think the crash came from some broken Blueprint structs inside my project, because some references broke away and the ContentManagerModule crashed while compiling. But now I can begin to fix these things. :joy:

Thank you very much :smiley:

Ah yes Live coding. I avoid it like the plague ;). I just fire up visual studio without debugging and a project build will update stuff in the engine most of the time. Unreal even gives an audio cue when the build is complete.

Then I’ll do that too from now on xD

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.