Editor Crash:: if (GetNumber() == NAME_NO_NUMBER_INTERNAL)

Hmm, what does your default constructor(s) look like for ST_ItemTypeAndID?

USTRUCT(BlueprintType)
struct FST_ItemTypeAndID : public FTableRowBase
{
	GENERATED_BODY()

public:
	//Defining the type of the item
	UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Item Type Setter")
	EItemType Type; 

	//Defining the ID of the item
	UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Item ID Setter")
	FName ID;  
};

I have doubt on this section at the top , the first for loop starts

for (auto Array : LobbySpawnLocationRows->GetRowNames())
{
	if (const UDataTable * LobbySpawnLocationRowNames{ LoadObject<UDataTable>(GetWorld(), TEXT("/Game/DataTables/ItemsGeneration/Locationtesting")) })
	{
		if (const FST_ItemGroupLocation * OutRow_LSN{ LobbySpawnLocationRowNames->FindRow<FST_ItemGroupLocation>(FName(Array), "") })
		{
			FVector SpawnTransform{};
			FTransform MakeTransform_Ret{};

			SpawnTransform = FVector(OutRow_LSN->Location);

			MakeTransform_Ret = UKismetMathLibrary::MakeTransform(SpawnTransform, FRotator(0.000000, 0.000000, 0.000000), FVector(1.000000, 1.000000, 1.000000));
			AActor* BeginSpawnClass = UGameplayStatics::BeginDeferredActorSpawnFromClass(this, AItemGroup::StaticClass(), MakeTransform_Ret, ESpawnActorCollisionHandlingMethod::Undefined, ((AActor*)nullptr));
			MakeTransform_Ret = UKismetMathLibrary::MakeTransform(SpawnTransform, FRotator(0.000000, 0.000000, 0.000000), FVector(1.000000, 1.000000, 1.000000));
			ItemGroupRef = CastChecked<AItemGroup>(UGameplayStatics::FinishSpawningActor(BeginSpawnClass, MakeTransform_Ret), ECastCheckedType::NullAllowed);

		}

		}

Add a default constructor that at least initializes the FName to the NONE state

FTableRowBase() { ID = FName(EName::None);; }

Also in general USTRUCT should have some kind of default constructor always I’m surprised that it even compiled without a warn

I have created this struct in the base class of item groups

Right, but in you’re blueprint you are using the make node, and that is going to use the default constructor for the struct to create it first before applying the assigned properties.

// Sets default values

AItemGroup::AItemGroup()
{
 	// Set this actor to call Tick() every frame.  You can turn this off to improve performance if you don't need it.
	PrimaryActorTick.bCanEverTick = true;

	//Used to create static mesh components for the purpose of group spawning items in the level
	CreateStaticMeshComponents();

}
USTRUCT(BlueprintType)
struct FST_ItemTypeAndID : public FTableRowBase
{
	GENERATED_BODY()

public:
	//Defining the type of the item
	UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Item Type Setter")
	EItemType Type; 

	//Defining the ID of the item
	UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Item ID Setter")
	FName ID;  <- Give some default value to ID like so FName ID = FName(EName::None)
};

I have tested it and still the same error

the id should be ID = FName("1"); the row name in the data table
image_2022-08-18_031954665

It was worth a shot. Were you able to add a breakpoint to your code to find exactly which line number was throwing exception after executing?

yes this is another function called by GenerateItems();
if you want to look, I can post that function, the function is about 100 lines of code, this is why I am asking if it worth to post
@Rumzie

I’ll take a quick gander. You should be able to add breakpoints within that function regardless?

sure I will add breakpoint and will post the code in few minutes

1 Like

MyGameMode.cpp (8.4 KB)

just two cases is shown in blueprint and the return


I think I know what it is. Think of FName as a unique string on a per scope basis. IE you can’t 2 assets with the same name in the same package in UE4.

In this code maybe you are creating 2 of the exact FName in the same scope?

case EItemType::E_Ammo:
		{
			if (const UDataTable* ItemAmmoRowNames = LoadObject<UDataTable>(GetWorld(), TEXT("/Game/DataTables/Items/Ammo/DT_ItemAmmo")))
			{
				for (auto& AmmoElemArray : ItemAmmoRowNames->GetRowNames())
				{
					if (const UDataTable* ItemAmmoFindRow{ LoadObject<UDataTable>(GetWorld(), TEXT("/Game/DataTables/Items/Ammo/DT_ItemAmmo")) })
					{
						if (const FST_ItemAmmo * OutRow_Ammo{ ItemAmmoFindRow->FindRow<FST_ItemAmmo>(FName(AmmoElemArray), "") })
						{
							if (OutRow_Ammo)
							{
								for (int32 i = 1; i <= OutRow_Ammo->ProbabilityPercent; i++)
								{
									TempTypeAndID_Setter.Type = EItemType::E_Ammo;
									TempTypeAndID_Setter.ID = FName(AmmoElemArray);
									Arr.Add(TempTypeAndID_Setter);//Adding elements

								}
							}
						}
					}
				}
			}
		}break;

Just taking this as a example you are using FName constructor twice with the same value FName(AmmoElemArray);

1 Like


This is the blueprint of the Ammo case you posted, you see any difference ? and it works in blueprints perfectly

I will now set the break points , will let you know if this is the exact reason

I changed from Development Editor to Debug Editor , and now it will take long time to start the editor? I see compiling lots of extra engine source files

Debug editor adds a lot of symbols that is normal, but you should be able to use VS breakpoints effectively without DebugEditor.