PuzzlePieces is a TArray<AActor*>
. I can’t debug any TArray
, I don’t see values when I put breakpoints. I just see the ArrayNum
value change when I add a value to the array :
UCLASS()
class PARMESANBANK_API APuzzle : public AActor
{
GENERATED_BODY()
public:
void AddPuzzlePiece(APuzzlePiece* NewPuzzlePiece);
void RemoveAllPuzzlePieces();
APuzzle::InitGrid()
protected:
UPROPERTY()
TArray<APuzzlePiece*> PuzzlePieces;
UPROPERTY(EditAnywhere)
int32 NbPuzzlePieces;
UPROPERTY(EditAnywhere)
int32 GridSizeX;
UPROPERTY(EditAnywhere)
int32 GridSizeY;
}
void APuzzle::AddPuzzlePiece(APuzzlePiece* NewPuzzlePiece)
{
if (IsValid(NewPuzzlePiece))
{
PuzzlePieces.AddUnique(NewPuzzlePiece);
}
}
void APuzzle::InitGrid()
{
NbPuzzlePieces = GridSizeX * GridSizeY;
FActorSpawnParameters SpawnParameters;
SpawnParameters.Owner = this;
for (int32 i = 0; i < NbPuzzlePieces; i++)
{
FTransform SpawnTransform = GetActorTransform();
APuzzlePiece* PuzzlePiece = GetWorld()->SpawnActor< APuzzlePiece>(APuzzlePiece::StaticClass(), SpawnTransform, SpawnParameters);
PuzzlePiece->AttachToActor(this, FAttachmentTransformRules::KeepRelativeTransform);
if (i == NbPuzzlePieces-1)
{
PuzzlePiece->SetPuzzlePieceIndex(0);
}
else
{
PuzzlePiece->SetPuzzlePieceIndex(i+1);
}
}
RemoveAllPuzzlePieces();
for (int32 i = 0; i < Children.Num(); i++)
{
AddPuzzlePiece(Cast<APuzzlePiece>(Children[i]));
}
}
I program with vscode on Mac, I installed the extensions: C/C++ Extension Pack; C#; CMake; CodeLLDB; MonoDebug. I don’t have any problem with other types of variables, only with TArray
.
I tried to solve this problem by applying the settings proposed by UE, but the problem is still there.