[4.14.3] FindId() Crash when spawning my Projectile?


     UE4Editor-CoreUObject.dll!TSet<UObjectBase * __ptr64,DefaultKeyFuncs<UObjectBase * __ptr64,0>,FDefaultSetAllocator>::FindId(UObjectBase * Key) Line 623    C++
     UE4Editor-CoreUObject.dll!TSet<UObjectBase * __ptr64,DefaultKeyFuncs<UObjectBase * __ptr64,0>,FDefaultSetAllocator>::Emplace<UObjectBase * __ptr64 const & __ptr64>(UObjectBase * const & Args, bool * bIsAlreadyInSetPtr) Line 495    C++
     UE4Editor-CoreUObject.dll!AddToClassMap(FUObjectHashTables & ThreadHash, UObjectBase * Object) Line 529    C++
     UE4Editor-CoreUObject.dll!HashObject(UObjectBase * Object) Line 881    C++
     UE4Editor-CoreUObject.dll!UObjectBase::AddObject(FName InName, EInternalObjectFlags InSetInternalFlags) Line 205    C++
     UE4Editor-CoreUObject.dll!UObjectBase::UObjectBase(UClass * InClass, EObjectFlags InFlags, EInternalObjectFlags InInternalFlags, UObject * InOuter, FName InName) Line 83    C++
     UE4Editor-CoreUObject.dll!StaticAllocateObject(UClass * InClass, UObject * InOuter, FName InName, EObjectFlags InFlags, EInternalObjectFlags InternalSetFlags, bool bCanRecycleSubobjects, bool * bOutRecycledSubobject) Line 2408    C++
     UE4Editor-CoreUObject.dll!StaticConstructObject_Internal(UClass * InClass, UObject * InOuter, FName InName, EObjectFlags InFlags, EInternalObjectFlags InternalSetFlags, UObject * InTemplate, bool bCopyTransientsFromClassDefaults, FObjectInstancingGraph * InInstanceGraph, bool bAssumeTemplateIsArchetype) Line 3206    C++
     UE4Editor-Engine.dll!NewObject<AActor>(UObject * Outer, UClass * Class, FName Name, EObjectFlags Flags, UObject * Template, bool bCopyTransientsFromClassDefaults, FObjectInstancingGraph * InInstanceGraph) Line 1227    C++
     UE4Editor-Engine.dll!UWorld::SpawnActor(UClass * Class, const FTransform * UserTransformPtr, const FActorSpawnParameters & SpawnParameters) Line 405    C++
>    UE4Editor-Engine.dll!UWorld::SpawnActor(UClass * Class, const FVector * Location, const FRotator * Rotation, const FActorSpawnParameters & SpawnParameters) Line 271    C++
     UE4Editor-OrtCloud.dll!AOrtCloudShipComponent::DoFire(int InIndex, AActor * CurrentTarget) Line 4789    C++
     UE4Editor-OrtCloud.dll!AOrtCloudShipComponent::DoBurst(int InIndex) Line 4714    C++
     UE4Editor-OrtCloud.dll!AOrtCloudShipComponent::StartBursting(int InIndex) Line 4603    C++
     UE4Editor-OrtCloud.dll!AOrtCloudShipComponent::execStartBursting(FFrame & Stack, void * const Z_Param__Result) Line 13    C++
     UE4Editor-CoreUObject.dll!UFunction::Invoke(UObject * Obj, FFrame & Stack, void * const Z_Param__Result) Line 4474    C++
     UE4Editor-CoreUObject.dll!UObject::ProcessEvent(UFunction * Function, void * Parms) Line 1308    C++
     UE4Editor-Engine.dll!AActor::ProcessEvent(UFunction * Function, void * Parameters) Line 649    C++
     UE4Editor-OrtCloud.dll!TBaseUFunctionDelegateInstance<AOrtCloudShipComponent,TTypeWrapper<void> __cdecl(void),int>::Execute() Line 128    C++
     UE4Editor-Engine.dll!FTimerUnifiedDelegate::Execute() Line 43    C++
     UE4Editor-Engine.dll!FTimerManager::Tick(float DeltaTime) Line 570    C++
     UE4Editor-Engine.dll!UWorld::Tick(ELevelTick TickType, float DeltaSeconds) Line 1394    C++
     UE4Editor-UnrealEd.dll!UEditorEngine::Tick(float DeltaSeconds, bool bIdleMode) Line 1422    C++
     UE4Editor-UnrealEd.dll!UUnrealEdEngine::Tick(float DeltaSeconds, bool bIdleMode) Line 371    C++
     UE4Editor.exe!FEngineLoop::Tick() Line 2859    C++
     UE4Editor.exe!GuardedMain(const wchar_t * CmdLine, HINSTANCE__ * hInInstance, HINSTANCE__ * hPrevInstance, int nCmdShow) Line 152    C++
     UE4Editor.exe!WinMain(HINSTANCE__ * hInInstance, HINSTANCE__ * hPrevInstance, char * __formal, int nCmdShow) Line 191    C++


My SpawnActor() Call:

FActorSpawnParameters SpawnParams;
SpawnParams.Owner = this;
SpawnParams.Instigator = Instigator;
SpawnParams.SpawnCollisionHandlingOverride = ESpawnActorCollisionHandlingMethod::AlwaysSpawn;

TempProj = GetWorld()->SpawnActor<AOrtCloudProjectile>(CurrentWeapon.WeaponDataClass.ProjectileClass, MuzzleLocation, MuzzleRotation, SpawnParams);

Values at My SpawnActor() Call:

this = 0x0000000039a790c0 (Name=0x000000002d1c42a8 "OC_SS_BasicCarrierCore_C"_0)
Instigator = 0x00000000340662c0 (Name=0x0000000034c390c8 "TopDownCharacter_C"_0)
CurrentWeapon.WeaponDataClass.ProjectileClass = Class=0x0000000039678100 (Name=0x000000002d1b7e88 "OC_WP_BasicRailProjectile_C")
MuzzleLocation = X=-255887.016, Y=-180951.141, Z=554.064270
MuzzleRotation = Pitch=-0.981532276, Yaw=98.1061172, Roll=0.000000000

**FindId() at BreakPoint(BreakLine at **):

    FSetElementId FindId(KeyInitType Key) const
        if (Elements.Num())
            for(FSetElementId ElementId = GetTypedHash(KeyFuncs::GetKeyHash(Key));
                ElementId = Elements[ElementId].HashNextId)
****            if(KeyFuncs::Matches(KeyFuncs::GetSetKey(Elements[ElementId].Value),Key))
                    // Return the first match, regardless of whether the set has multiple matches for the key or not.
                    return ElementId;
        return FSetElementId();

Values at Debug BreakPoint:

Key = 0x000000002a3c0f00 (Name=0x000000002d1b7e88 "OC_WP_BasicRailProjectile_C"_54)
Elements.Num() = 21
Elements.[1] = 0x0000000041f86c90 Value=0x0000000035617900 (Name=0x000000002d1b7e88 "OC_WP_BasicRailProjectile_C"_37)
----(includes 20 other entries representing the other projectiles that have been successfully spawned up until this point)
----("OC_WP_BasicRailProjectile_C"_54 is not in the list)
ElementId.Index = 993415360

Is ElementId.Index valid? or is that massive number an indication that it hasn’t initialized by this point?
What is it about “Key” that would cause it to fail here?
And if all the data I input is valid when I first call SpawnActor() how can I fix this?
Am I not setting FActorSpawnParameters correctly?

If you need any further info, please ask. I will try to keep the VS breakpoint active as long as I can so I can copy/paste the values.
Visual Studio crashed so I guess I won’t be able to get beakpoint data, unless I can get the crash again. :frowning:

Have you verified the ProjectileClass you are passing to Spawn Actor is valid?

CurrentWeapon.WeaponDataClass.ProjectileClass = Class=0x0000000039678100 (Name=0x000000002d1b7e88 “OC_WP_BasicRailProjectile_C”)

Doesn’t that indicate it is? It also spawned it 21 times before this point. Or is there something else in the Debug values I should look for to indicate if it is valid?

But to answer, I used:
if (CurrentWeapon.WeaponDataClass.ProjectileClass)
And ProjectileClass is initialized in the struct as NULL.

Would that not work? Is there an actual check for that I can stick in the code?

EDIT: Also Visual Studio just crashed so I guess I won’t be able to get beakpoint data, unless I can get the crash again. :frowning: