This is my .h header:
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "GameFramework/Actor.h"
#include "MyActor.generated.h"
UCLASS()
class MYPROJECT_API AMyActor : public AActor
{
GENERATED_BODY()
public:
// Sets default values for this actor's properties
AMyActor();
// Called when the game starts or when spawned
virtual void BeginPlay() override;
// Called every frame
virtual void Tick( float DeltaSeconds ) override;
UPROPERTY(EditAnywhere, Category = "Assets")
USceneComponent *ActorsOnEachNote[2] ;
};
And I try to create new instance, like below:
// Fill out your copyright notice in the Description page of Project Settings.
#include "MyProject.h"
#include "MyActor.h"
// Sets default values
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;
ActorsOnEachNote[0] = CreateDefaultSubobject<USceneComponent>(TEXT("Test blah 0"));
ActorsOnEachNote[1] = CreateDefaultSubobject<USceneComponent>(TEXT("Test blah 1"));
}
// Called when the game starts or when spawned
void AMyActor::BeginPlay()
{
Super::BeginPlay();
}
// Called every frame
void AMyActor::Tick( float DeltaTime )
{
Super::Tick( DeltaTime );
}
Then something odd happened, both ActorsOnEachNote[0] and ActorsOnEachNote[1] created successfully, but
ActorsOnEachNote[0] changed name into ActorsOnEachNote rather than “Test blah 0” I set above, but I can live with that.
**The deadly problem to me is that the ActorsOnEachNote[1] can not be edited in editor! **
What did I miss?
Or Unreal Engine doesn’t support setting UPROPERTY to EditAnywhere for an array?
If it doesn’t, then what should I do to make ActorsOnEachNote[1] editable in editor?
-----------------------------[ActorsOnEachNote[0]]-----------------------------
-----------------------------[ActorsOnEachNote[1]]-----------------------------