You might want/need to add “BlueprintType” to your UCLASS Macro. If it’s a component, then the meta “BlueprintSpawnableComponent” would likely also be needed.
Just an FYI: The use of BlueprintSpawnableComponent is limited to Components (so UActorComponent, for example). So if your class isn’t a component and adding that tag doesn’t work, at least you’ll know why
And if it’s still not working, do post back! Always start with the simplest of possible solutions and we can work our way through until we reach a proper answer.
For people who stumbled here.
In my case, I was inheriting from UActorComponent and BlueprintSpawnableComponent didn’t work. I had also to add:
UCLASS( ClassGroup=(Custom), meta=(BlueprintSpawnableComponent), BlueprintType, Blueprintable )
Without Blueprintable it still wasn’t exposed for subclassing in the editor. (UE5)
Im just trying to make a simple c++ obj I`ve tried some things nothing works.
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "UObject/NoExportTypes.h"
#include "CPP_Object_1.generated.h"
/**
*
*/
UCLASS( ClassGroup=(Custom), meta=(BlueprintSpawnableComponent), BlueprintType, Blueprintable )
class CODING_GROUND_API UCPP_Object_1 : public UObject
{
GENERATED_BODY()
private:
int OurPrivateIntegerVariable;
public:
int GetOurPrivateIntegerVariable();
void SetOurPrivateIntegerVariable(int NewValue);
};
Um, for you, looks like you are trying to get the UObject to level editor.
And UObjects are not made to be dropped into the level editor. Instead, use “AActor” or “UActorComponent” and drop them into UE5 editor scene.
If AActor:
UCLASS(Blueprintable, BlueprintType)
class MYGAME_API AAircraft : public AActor
If UActorComponent:
UCLASS(ClassGroup = (MyGameActors), meta = (BlueprintSpawnableComponent)) // Edited this one, I add meta here.
class MYGAME_API UAircraftComponent : public USceneComponent
Notice the change? UObject is replaced with something else. Again, UObject cannot be used as Actors or Components of Actors. That’s why you cannot see it.
If you’re trying to create AMyGamePawn pawn than, Wrong way:
UCLASS(Blueprintable, BlueprintType)
class MYGAME_API AMyGamePawn : public UObject
Correct way:
UCLASS(Blueprintable, BlueprintType)
class MYGAME_API AMyGamePawn : public APawn
Spot the different again? UObject is replaced by APawn