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.