i have a private member of type:
TArray<TArray<class AActor*> > m_2DArray;
or a 2 dimensional array of AActors…
The game works fine but after a minute or so the game just crashes!
on a different lines but all related to access to m_2DArray…notice the same lines worked before and suddenly not.
i do a null check on an actor in the array so its not an actor.
how ever it seems that the member m_2DArray itself is being garbage collected…
I read somewhere that unreal does not support nested arrays but i can not find an official explanation.
Does someone knows it for sure ?
it always crashes about one minute after begin play on one of the access lines to the member…
here is the code:
void UMicroGridComponnet::Fill()
{
FVector l_Location = m_GridLocation;
l_Location.Z += m_CollisionSize.Z*m_AmountOfTiles*2;
l_Location.Y -= m_GridSize.Y - m_GridSize.Y/m_AmountOfTiles;
for (uint8 Columns = 0; Columns < m_AmountOfTiles; ++Columns)
{
for (uint8 Rows = 0; Rows < m_AmountOfTiles; ++Rows)
{
UE_LOG(LogTemp, Warning, TEXT("Create Tile Row: %d Column: %d"),Rows,Columns);
m_TileArray[Rows][Columns] = m_TileFactory->CreateRandomColorTileAtLocation(l_Location);
}
l_Location.Y += m_GridSize.Y/m_AmountOfTiles*2 ;
}
}
void UMicroGridComponnet::Discard()
{
for (uint8 Columns = 0; Columns < m_AmountOfTiles; ++Columns)
{
for (uint8 Rows = 0; Rows < m_AmountOfTiles; ++Rows)
{
if( m_TileArray[Rows][Columns] != NULL)
{
m_TileArray[Rows][Columns]->Destroy(true,true);
m_TileArray[Rows][Columns] = NULL;
UE_LOG(LogTemp, Warning, TEXT("Destroy Row: %d Column: %d"),Rows,Columns);
}
}
}
}