1205
(1205)
1
TArray tArray[100];
void WantAdd_the_Index(int _idx, AActor* _pActor)
{
(*tArray)[_idx] = _pActor;
}
if idx 0, fine
idx 0 = Empty and,
but add Array upper 0 index, Create Error
ex)
-
(*tArray)[0] = NULL
-
(*tArray)[1] = _pActor;
how can i add index array?
Jamie_Dale
(Jamie Dale)
2
I’m guessing some of your code got eaten by our parser, and that your first line was actually this?
TArray<AActor*> tArray[100];
You do realise that’s creating a static array of 100 dynamic arrays… right?
If you wanted a static array of 100 actor pointers, you should have done this.
AActor* tArray[100];
If you wanted to use a dynamic array, but resize it to hold 100 entries, then you should have done this.
TArray<AActor*> tArray;
tArray.SetNum(100); // or SetNumZeroed to null all the pointers in the array
1205
(1205)
3
if i use AActor* tArray[100];
althougth i call tArray[2] = _pActor,
but tArray[2] is stll NULL
< premise : tArray[0],tArray[1] is not insert >