Hello every one… I am facing a really horrible bug… Been working on it all night (6am now) but still cannot find a way to solve it.
Basically I got a array having structure pointers that are pointing to another array having values.
FItemStruct TempStruct;
TempStruct.Fok = 11;
for (int8 i = 0; i < Storage.Rows.Num(); i++)
{
for (int8 j = 0; j < Storage.Rows*.Columns.Num(); j++)
{
StorageArray.Add(TempStruct);
Storage.Rows*.Columns[j].ItemStruct = &StorageArray[StorageArray.Num() - 1];
GEngine->AddOnScreenDebugMessage(-1, 15, FColor::Cyan,
FString::FromInt(i) + " " +
FString::FromInt(j) + " " +
FString::FromInt(Storage.Rows*.Columns[j].ItemStruct->Fok));
}
}
This is how I am initializing both the Main array and the array containing the references. I neglected 1 part that the reference array is a 2d array… But it shouldn’t be the problem here.
The StorageArray is the main storage location while the Storage.Rows*.Columns[j].ItemStruct contains the pointer to the location
The I am initializing a value just for testing
TempStruct.Fok = 11;
Here in the Screen message, everything appears fine…
Then when I check the value when Ticking, a few values appeared to have changed. Only if i check them through the storage pointer.
While the actual values in the variable array doesn’t change
The Tick function
for (int8 i = 0; i < Storage.Rows.Num(); i++)
{
for (int8 j = 0; j < Storage.Rows*.Columns.Num(); j++)
{
if (Storage.Rows*.Columns[j].ItemStruct)
{
GEngine->AddOnScreenDebugMessage(-1, DeltaSeconds, FColor::Green,
FString::FromInt(i) + " " +
FString::FromInt(j) + " " +
FString::FromInt(Storage.Rows*.Columns[j].ItemStruct->Fok));
}
}
}
for (int8 k = 0; k < StorageBase.Num(); k++)
{
GEngine->AddOnScreenDebugMessage(-1, DeltaSeconds, FColor::Blue, FString::FromInt(StorageBase[k].Fok));
}
Also one very important thing is my pointer is not a** smart pointer** but a naked pointer.
FItemStruct* ItemStruct;
I cant have UPROPERTY() structure pointers