I would like to set the Static Mesh of a Static Mesh Component by referencing a UStaticMesh property via the constructor in C++. It works via BeginPlay, Tick, and the constructor via Blueprints, but not the constructor via C++.
The desired effect would be to select a static mesh for the UProperty and have that propagate to several Static Mesh Components on the actor while in the editor (before pressing play).
#pragma once
#include "CoreMinimal.h"
#include "GameFramework/Actor.h"
#include "Engine/StaticMesh.h"
#include "PropagateActor.generated.h"
UCLASS()
class YOUR_API APropagateActor : public AActor
{
GENERATED_BODY()
public:
// Sets default values for this actor's properties
APropagateActor();
protected:
// Called when the game starts or when spawned
virtual void BeginPlay() override;
public:
// Called every frame
virtual void Tick(float DeltaTime) override;
UPROPERTY(BlueprintReadWrite,EditAnywhere)
UStaticMesh* TargetMesh;
UPROPERTY(BlueprintReadWrite, EditAnywhere)
UStaticMeshComponent* Mesh1;
void PostEditChangeProperty(FPropertyChangedEvent& PropertyChangedEvent) override;
};