Edit: Why array size not increased on adding items? C++

I will try to do a quick edit, but this is not guaranteed it will work, but you will get better understandings of your mistakes in your code

case EItemType::E_Weapon:
		{
			if (const UDataTable* DT_ItamWeaponRows = LoadObject<UDataTable>(GetWorld(), TEXT("/Game/DataTables/DT_ItamWeapon")))
			{
				OutRowNames = DT_ItamWeaponRows->GetOutRowNames();
			}
			for (auto& StructArrElem  : OutRowNames)
			{
				if (const UDataTable* DT_ItamWeapon{ LoadObject<UDataTable>(GetWorld(), TEXT("/Game/DataTables/DT_ItamWeapon")) })
				{
					if (const FST_ItemWeapon * OutRow{ DT_ItamWeapon->FindRow<FST_ItemWeapon>(FName(StructArrElem ), "") })
					{
						if (OutRow)
						{
							WeaponItemDatas = *OutRow;
							TempItemTypeAndID_var.ID = StructArrElem ;
						}
					}
				}
			}
				for (int i = 1; i <= WeaponItemDatas.ProbabalityPercent; i++)
				{
					TempItemTypeAndID_var.Type = EItemType::E_Weapon;
					StructArr.Add(TempItemTypeAndID_var);
				}

		}

hope it helps
cheers.

1 Like

Thank you very much Sir :upside_down_face: , you just solved my problem to increase the array size on the bases of a ProbabalityPercent, but if i will have issue adding items I will open another thread,
Thank you all for contributing to fix this issue :slight_smile:

1 Like

glad it works
cheers!

1 Like