UE4 - Make pointer to custom UObject editable in Blueprint

Started by
4 comments, last by .chicken 9 years, 3 months ago

Hi, I'm just getting started with UE4. What I'm trying to do is the following:

I have a custom class derived from UObject, lets call it MyClass.

I then have AnotherClass looking like this..


UCLASS()
class MY_PROJECT_API AAnotherClass : public APlayerController
{
	GENERATED_UCLASS_BODY()
public:
	/** ... */
	UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Tracking")
		class UMyClass* MyClass;
	

In the editor I have a Blueprint of AnotherClass and I want to assign a Blueprint of MyClass to that UPROPERTY. Is there any way to do this? Google couldn't really help me out here....

Thanks in advance.

Advertisement

What kind of problem are you getting?

Is the widget not visible within the details tab within the editor? Are you getting a type conflict which prevents you from adding the BP?

Also: You'd probably get a faster and more accurate response by looking around on the UE4 forums.

I cant get a reference to my MyClass_BP in AnotherClass_BP.

175c8856e39f1f5861e5909d764225dc.png

I can only select 'None'.

Thanks for the UE forums hint, I'll check it out as well.

The UI has an internal object filter which automatically filters out invalid types. When that happens to me, usually it indicates that the class / object its looking for can't be found.

Oh. This just occurred to me.

You should look at your UCLASS macro. Your class probably isn't showing up because its not visible to the editor. You'll want to add something like
UCLASS(Blueprintable, BlueprintType)

This should make your class visible within the editor and allow you to derive blueprints from your class. It may also make your class visible on that dropdown menu.

Oh. This just occurred to me.

You should look at your UCLASS macro. Your class probably isn't showing up because its not visible to the editor. You'll want to add something like
UCLASS(Blueprintable, BlueprintType)

This should make your class visible within the editor and allow you to derive blueprints from your class. It may also make your class visible on that dropdown menu.

I did that already :/

Edit: I got it solved, by using TSubclassOf<ClassA> as the UPROPERTY!

This topic is closed to new replies.

Advertisement