C++ Property not editable in Editor

Hi guys,

I’m new to Unreal Engine and there is a thing that i can’t resolve. I created an UCapsuleComponent to detect walls.
But i can’t edit it in the Editor :

I tought that I used the corrects tags but it doesn’t seems to be good.
Here is my code:

header file:

UPROPERTY(EditDefaultsOnly, BlueprintReadWrite, meta = (AllowPrivateAccess = "true"))
	class UCapsuleComponent* WallDetection;

cpp file:

WallDetection = CreateDefaultSubobject<UCapsuleComponent>(TEXT("WallDetection"));
	WallDetection->InitCapsuleSize(80.f, 110.0f);
	WallDetection->SetupAttachment(GetCapsuleComponent());
	WallDetection->bEditableWhenInherited = true;
	WallDetection->BodyInstance.SetCollisionProfileName("Trigger");
	WallDetection->SetCollisionEnabled(ECollisionEnabled::QueryOnly);
	WallDetection->SetFlags(RF_MarkAsNative);

	WallDetection->OnComponentBeginOverlap.AddDynamic(this, &AClutchCharacter::OnOverlapBegin);
	WallDetection->OnComponentEndOverlap.AddDynamic(this, &AClutchCharacter::OnOverlapEnd);

Thanks in advance for further answers :slight_smile:

1 Like

Hey there, set to VisibleDefaultsOnly instead of EditDefaultsOnly.

1 Like

Hey! thnaks for the reply but it seems that it is not working :confused: I think that there is a real issue because i tried many tags but none of them did the job …

1 Like

Nope, can’t test right now, but why do i need te restart the engine since there is a compile button ? :slight_smile:

1 Like

Alright :slight_smile: Thanks for the tip, i’ll update this post if it works :slight_smile:

1 Like

Have you restarted the engine after changing the tags?

1 Like

Because hot reload has a lot of issues, especially when you change things in the header file.

1 Like

That image is in the blueprint editor or on the editor itself after selecting an instance?

1 Like

Nope it didn’t work ):

1 Like

Try using:

UPROPERTY(VisibleDefaultsOnly, BlueprintReadOnly, Category = "Test")
1 Like

Try removing these things:

meta = (AllowPrivateAccess = "true")

WallDetection->bEditableWhenInherited = true;
WallDetection->SetFlags(RF_MarkAsNative);
1 Like

editor itself, there’s nothing displayed in BP editor:

1 Like

Same, not working, I wonder if there’s an option on the editor to enable it maybe ?

And each time I reboot the engine, and look in the blueprint editor :slight_smile:

1 Like

Nope still not working, I guess i’ll do without it haha

1 Like

Alright it works if I do create a blueprint class ! Thanks, I now need to learn what’s the difference hehe.

1 Like

Hi there.

I see you’ve already done some trouble shooting, but I just did a quick test using a blank project in 4.17 and was able to edit a c++ inherited capsule component from blueprints. Maybe there is an issue with the accessibility of the variable or something. It’s peculiar for sure, but hopefully you might get some insight from my tests. Image and code below.

Here’s my code for your reference

// MyActor.h

#include "CoreMinimal.h"
#include "GameFramework/Actor.h"
#include "Components/CapsuleComponent.h"
#include "MyActor.generated.h"

UCLASS()
class LEARNINGCPP_API AMyActor : public AActor
{
	GENERATED_BODY()

	// An example capsule component
	UPROPERTY(VisibleDefaultsOnly, Category = "Components", Meta = (AllowPrivateAccess = "true"))
		UCapsuleComponent* MyCapsule;

         // Other code.....
}

// MyActor.cpp

#include "MyActor.h"

AMyActor::AMyActor()
{
 	// Set this actor to call Tick() every frame.  You can turn this off to improve performance if you don't need it.
	PrimaryActorTick.bCanEverTick = true;

	MyCapsule = CreateDefaultSubobject<UCapsuleComponent>(TEXT("MyCapsule"));
	MyCapsule->InitCapsuleSize(80.f, 110.f);
	MyCapsule->SetupAttachment(GetRootComponent()); // Attach to the default root

}

Hopefully that helps!

1 Like

Try making a new blueprint out of that c++ class, other than that i’m not seeing any reason why it’s not working. The rest of the components are working fine?

1 Like

Thanks for answering :slight_smile: It always help ! But I found out that the autogenerated code from the first person shooter template automaticaly creates a FirstPersonCharacter bp class which has MyCharacter as parent. In this case, the walldetection will not be editable.
But if I create a bp class from MyCharacter, it works !
It’s a tricky relation but I need to understand it, in order to spawn a “MyCharacter” instead of a “FirstPersonCharacter” :slight_smile:

1 Like

And an other thing, if I spawn a “Mycharacter”, it doesn’t fire projectile like the “FirstPersonCharacter”.
It’s weird because both bp classes have MyCharacter as parent.

1 Like

Have you resolved that issue? I have same problem, EditAnywhere/VisibleAnywhere doesn’t work

1 Like