Problem with using TArray

hello,
i have created a class that inherit from UObject and in another class i keep an TARRAY:

UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = Buff)
 TArray<UBuff *> BuffsArray;

i succesfully add to the array an item but when i try this line:

BuffsArray[ind]->RecalculateCharacterStats(parentChar);

(ind = 0 checked in the debugger)
checking in the debugger lead me to a fucntion called Bind ( in class.cpp) in the line:

	UE_LOG(LogClass, Fatal, TEXT("Can't find ClassConstructor for class %s"), *GetPathName() );

which output the following error:

[2014.07.12-09.29.37:993][704]LogWorld: Bringing World
/Game/Maps/UEDPIE_0_Example_Map.Example_Map
up for play (max tick rate 0) at
2014.07.12-12.29.37 [2014.07.12-09.29.37:995][704]LogWorld: Bringing up level for play took:
0.004808 [2014.07.12-09.29.37:996][704]LogPlayerController: Spawned spectator SpectatorPawn_0
[server:1]
[2014.07.12-09.29.37:997][704]LogGameMode: RestartPlayer 256
[2014.07.12-09.29.37:999][704]LogPlayerController: ClientRestart_Implementation
MyCharacter_C_0
[2014.07.12-09.29.37:999][704]LogPlayerController: ServerAcknowledgePossession_Implementation
MyCharacter_C_0
[2014.07.12-09.29.38:003][704]PIE:
Info Play in editor start time for
/Game/Maps/UEDPIE_0_Example_Map -0.522
The thread 0x1040 has exited with code
0 (0x0). The thread 0xd38 has exited
with code 0 (0x0). The thread 0x12d4
has exited with code 0 (0x0). The
thread 0x67c has exited with code 0
(0x0). The thread 0x16f4 has exited
with code 0 (0x0). The thread 0x19c
has exited with code 0 (0x0). The
thread 0x17b8 has exited with code 0
(0x0). The thread 0x1608 has exited
with code 0 (0x0). The thread 0x12b0
has exited with code 0 (0x0).
D:\CrystalRealms\UE4.2\UnrealEngine\Engine\Source\Runtime\CoreUObject\Private\UObject\Class.cpp(2565):
Fatal error: Can’t find
ClassConstructor for class
/Engine/Transient.Class_0
UE4Editor.exe has triggered a
breakpoint.

Please post the adding code. It seems to me that you are trying to store an index value for your newly added item. Array indices shift every time something is removed from the array by default, so it is not a very reliable solution. Also, is this code located in the constructor? You can easily see what is inside your TArray in debug time by using the Visual Studio visualizer plugin, see the installation instructions on the bottom of this page.

thats okay thank you fixed it i had problem with creating the object i insert inside. (btw i wasn’t saving index it was inside for loop)

Hi mdluffy,

Would you be able to post an answer explaining how you resolved your issue? If other users run into the same issue, it would be helpful for them to see how you resolved it.

yeah you are right im sorry post soon

okay the problem was happening actually not because of the TARRAY but the UObject i added to the tarray was not okay.
in my case:

UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Buff)
TSubclassOf<class UBuff> BuffToAdd;

i have a pickupBuff item which on pickup create a certain buff based on this variable and add it to the character.(so i can decide which buff a pickup add on content level(editor))
creating the object:
this line was the problematic:

UBuff *buff = NewObject<UBuff>(GetTransientPackage(),BuffToAdd->GetClass());

fixing the problem:

UBuff *buff = NewObject<UBuff>(GetTransientPackage(),*BuffToAdd);

the buff variable is then added to the tarray (and i try to use it in the above code) and because the variable is not initialized correctly it has some problem.