In my character i have a variable with type TArray2D that is initialized on the constructor with:
MyCustomArray.Init(10, 10, NULL);
When i put a breakpoint on line 4 of the Init function i check the function parameters values and it tells me:
Rows 41646784 unsigned int
Columns 260795136 unsigned int
But when i write them using:
UE_LOG(LogTemp, Warning, TEXT("Array with %d %d"), Rows, Columns);
It shows “Array with 10 10” as it should and then he crashes in the for loop on line 6. Do you know why Visual Studio is giving me incorrect values? This isn’t the first time this has happened, there were other times where he tells the incorrect value.
Did you check the value after the Init function was called? Or did you put the breakpoint on Init and check the value. As it will display some uninitialized value prior to Init actually being called. Placing a breakpoint on a line will stop the execution before than line is called.
I placed the breakpoint on Array.Init(Rows); of the Init function and i check Rows and Columns on Visual Studio and he has those weird values, sinces he’s already inside the function the values should have been set for the parameters.
This may be happening because you aren’t building with the correct Solution Configuration in Visual Studio. Try changing it to “DebugGame Editor” and the debugger should show the correct value.
I believe that did the trick, the only thing that is left to fix is the crash on the for loop when initializing the sub arrays inside the array, but i will open a new thread about it, thank you.