Cannot edit an inherited Static Mesh component in a Blueprint created from a C++ class

EDIT: So I just decided to try deleting my Blueprint class and re-creating it, and suddenly, I am able to access the component and assign it a value!

I’m still not sure why this worked, though - is it not possible to edit code behind a Blueprint anymore, without having to then re-create the blueprint?

Or, perhaps… I didn’t recompile the Blueprint and that could have been the issue the entire time?

Hi gang,

I am following some videos on Udemy by Stephen Ulibarri about UE4 C++ programming, and I’ve encountered an issue I hope can be resolved here.

In one of the lectures, Stephen has us create a basic actor C++ class, and then a Blueprint from that class. He has us create a StaticMesh component that we should be able to edit from the Blueprint, but the problem is that while the Static Mesh component shows up in the Blueprint, absolutely nothing shows up in the Details panel, and thus nothing can be done to it.

The code:


Floater.h:
// Fill out your copyright notice in the Description page of Project Settings.

#pragma once

#include "CoreMinimal.h"
#include "GameFramework/Actor.h"
#include "Floater.generated.h"

UCLASS()
class LEARNUE4FIRSTPROJECT_API AFloater : public AActor
{
    GENERATED_BODY()

public:    
    // Sets default values for this actor's properties
    AFloater();

    // Our StaticMesh component
    UPROPERTY(VisibleAnywhere, Category = "Tests")
    UStaticMeshComponent* StaticMesh;

protected:
    // Called when the game starts or when spawned
    virtual void BeginPlay() override;

public:    
    // Called every frame
    virtual void Tick(float DeltaTime) override;

};

Floater.cpp:


#include "Floater.h"

// Sets default values
AFloater::AFloater()
{
    // 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;

    // Initialize static mesh component
    StaticMesh = CreateDefaultSubobject<UStaticMeshComponent>(TEXT("StaticMesh"));
}

// Called when the game starts or when spawned
void AFloater::BeginPlay()
{
    Super::BeginPlay();
}

// Called every frame
void AFloater::Tick(float DeltaTime)
{
    Super::Tick(DeltaTime);
}

Something else to note is that in the Details panel underneath the World Outliner, this text appears when clicking on the Static Mesh (Inherited) component of the blueprint:


Native components are editable when declared as a Uproperty in C++.

Of course, as you can see, I am declaring it as a UPROPERTY, so I’m quite confused. Can anyone help me clear this up? I’m not sure why it works in the videos, but not for me.

Sometimes you have to re-create the Blueprint, especially if you added the component already and then changed the UPROPERTY() meta - and definitely if you ever remove any components.

The reason is that some of those properties are already serialized (saved) into the Blueprint and there’s no way to access/modify them once they have changed.

3 Likes

Thank you for this clarification, this does make a lot of sense. I sort of figured that may be the case but couldn’t find much reference anywhere.

I really wish the instructor mentioned this in the video - there is a pretty obvious splice and I wonder if it was a section that didn’t record for him (or he paused and forgot to un-pause his recording), and somehow he left out the part where the Blueprint needed to be re-created.

In a few videos later he did have us re-create the Blueprint, but it was to “reset” it, not for any other reason, at least that he mentioned.

Anyway, again, thanks for the answer! :slight_smile:

1 Like

I have the same problem. Recreating resolve this problem, but reparenting to actor and back to your class resolve this problem too. It can be useful if there are a lot of code in your blueprint, etc.

4 Likes

Found another solution. Just change blueprint parent class with something, compile and back. Helped me

3 Likes