Cook : Invalid object index

When cooking I received:

Cook: LogModuleManager: Warning: ModuleManager: Unable to load module 'D:/KadeoGames/UDK/KSGM/Binaries/Win64/UE4Editor-KSGM.dll' because the file couldn't be loaded by the OS.
Cook: LogUObjectArray: Warning: Invalid object index -572662307
Cook: LogUObjectArray: Warning: Invalid object index -572662307
Cook: LogUObjectArray: Warning: Invalid object index -572662307
Cook: LogUObjectArray: Warning: Invalid object index -572662307
Cook: LogUObjectArray: Warning: Invalid object index -572662307
Cook: LogUObjectArray: Warning: Invalid object index -572662307
Cook: LogUObjectArray: Warning: Invalid object index -572662307
Cook: LogUObjectArray: Warning: Invalid object index -572662307
Cook: LogUObjectArray: Warning: Invalid object index -572662307
Cook: LogUObjectArray: Warning: Invalid object index -572662307
Cook: LogUObjectArray: Warning: Invalid object index -572662307
Cook: LogUObjectArray: Warning: Invalid object index -572662307
Cook: LogUObjectArray: Warning: Invalid object index -572662307
Cook: LogUObjectArray: Warning: Invalid object index -572662307
Cook: LogUObjectArray: Warning: Invalid object index -572662307

In 4.15.3 no problem.

How can I display detailed log to know which objects are concerned ?

Hello , the information pertaining to what assets could be related should be elsewhere in the log. Could you provide the full log file? I’d also check any pointers you have that could possibly not be valid when referenced.

Hello Matthew,

I’ve got an old log with additional traces. I hope it is convenient for you.
If not, no problem, I can generate a new one.

link text

Unfortunately this is only the cook log and does not contain information about the entire process. The full log I’m looking for is what you would find in the project’s directory under Saved/Logs. As for trying to debug this, I would suggest turning your attention towards the “Unable to load module” error message, as that is likely the cause of the other issues. There have been other reports but the ways that it has been fixed are varied.

Hi Matthew,
I’ve tried to cook again using the FrontEnd app and when I launch the cooking process, I cannot find the log file you are talking about under the project’s directory in sub-folder ./Saved/Logs. (D:\KadeoGames\UDK\KSGM\Saved\Logs)
No file are created except the lines in the FrontEnd application.

However, when I launch the packaging process within the UE Editor, effectively, there is a log.
If this is the one you are talking about, it’s attached.

link text

Thank you for those logs. I forgot to mention that the logs would be placed elsewhere if you were cooking in a way that did not involve the standard method of packaging directly from the Editor.

From looking at the log provided, there is a crash that is occurring during the packaging process, with the following error message: “Attempt to process /Script/KSGM/KDamageType before it has been added.”

From the section this comes from, this seems to be an Async loading issue so I would suggest attempting to disable it temporarily to see if that allows you to bypass this crash. You can find the setting in your project settings. The same goes for EDL as the two settings usually tend to cause the same sort of issues.

When looking up the crash itself, I came across this post where a user reports that this solved the issue for them: “The solution was to use LoadObject() instead of FObjectFinder and move the loading from the constructor to an initialization function called later. This way, the default object construction does not attempt to load blueprints.”

Please let me know if this helps or what results you’re getting after looking into these leads.

Edit: Grammar

I’ve tried to disable the Async Loading by unchecking the Event Driven Loader Enabled.

The I’ve tried to package, and same issue.

I will try to replace the FObjectFinder by LoadObject.

I’ve commented all
static ConstructorHelpers::FObjectFinder<> in constructors,
and I still have the same issue.
It should be something else.

I found the problem, but I have no idea why.
You might be able to help me.

As you can see I have a class UKDamageType

The header

/* <source>UKDamageType module KDamageType.h
Interface of the UKDamageType class.</source>

<copyright>Kadeo Classes Copyright 2014 - Kadeo, All rights reserved.

This source code is only intended as a supplement to the
Kadeo Class Reference and related electronic documentation
provided with the library. See these sources for detailed
information regarding Kadeo products.</copyright>
<code>Source/KSGM/Objects/Weapons/KDamageType.h</code>
<created>09/2014</created>
<author>dominique.aigroz@kadeo.net<author>
*/

#pragma once

#include "GameFramework/DamageType.h"
#include "GameFramework/ForceFeedbackEffect.h"
#include "KDamageType.generated.h"


/** @brief Values that represent EKDamageTypeEnum.    
 *         http://chemistry.about.com/od/elementgroups/a/noblegaseslist.htm
 *         - Helium
 *           Atomic Number: 2
 *           Helium Symbol: He
 *           Atomic Weight: 4.002602(2)
 *
 *         - Neon
 *           Atomic Number: 10
 *           Symbol: Ne
 *           Atomic Weight: 20.1797
 *
 *         - Argon
 *           Atomic Number: 18
 *           Symbol: Ar
 *           Atomic Weight: 39.948
 *           
 *         - Krypton
 *           Atomic Number: 36
 *           Symbol: Kr
 *           Atomic Weight: 83.80
 *
 *         - Xenon
 *           Atomic Number: 54
 *           Symbol: Xe
 *           Atomic Weight: 131.29
 *           
 *         - Radon  
 *           Atomic Number: 86
 *           Symbol: Rn
 *           Atomic Weight: 222.0176
*/
UENUM(BlueprintType)
enum class EKDamageTypeEnum : uint8
{
	KDT_Orange		 			UMETA(DisplayName = DKT_GEN_HELIUMORANGE),		// 0
	KDT_Yellow				 	UMETA(DisplayName = DKT_GEN_NEONYELLOW),		// 1
	KDT_Blue	 				UMETA(DisplayName = DKT_GEN_ARGONBLUE),			// 2
	KDT_Gold				 	UMETA(DisplayName = DKT_GEN_KRYPTONGOLD),		// 3
	KDT_Purple				 	UMETA(DisplayName = DKT_GEN_XENONPURPLE),		// 4
	KDT_Red					 	UMETA(DisplayName = DKT_GEN_RADONRED),			// 5
	KDT_Green				 	UMETA(DisplayName = DKT_GEN_NEUTRALGREEN),		// 6
	KDT_Max					 	UMETA(Hidden)									// count = 7
};

/**
 * @brief DamageType class that specifies type of damage.
 */
UCLASS(const, Blueprintable, BlueprintType)
class KSGM_API UKDamageType : public UDamageType
{
	GENERATED_UCLASS_BODY()

	/** physical damage ? */
	UPROPERTY(EditDefaultsOnly, Category = Damage)
	bool Physical;

	/** this damage type */
	UPROPERTY(EditDefaultsOnly, Category = Damage)
	EKDamageTypeEnum Type;

	/** force feedback effect to play on a player hit by this damage type */
	UPROPERTY(EditDefaultsOnly, Category=Effects)
	UForceFeedbackEffect *HitForceFeedback;

	/** force feedback effect to play on a player killed by this damage type */
	UPROPERTY(EditDefaultsOnly, Category=Effects)
	UForceFeedbackEffect *KilledForceFeedback;
};



/**
* @brief DamageType class that specifies the suicide.
*/
UCLASS(const, Blueprintable, BlueprintType)
class KSGM_API UKDamageType_Suicide : public UKDamageType
{
	GENERATED_UCLASS_BODY()
};

The source file

/* <source>UKDamageType module KDamageType.cpp
Implementation of the UKDamageType class.</source>

<copyright>Kadeo Classes Copyright 2014 - Kadeo, All rights reserved.

This source code is only intended as a supplement to the
Kadeo User's Guide and related electronic documentation
provided with the library. See these sources for detailed
information regarding the Kadeo product.</copyright>
<code>Source/KSGM/Objects/Weapons/KDamageType.cpp</code>
<created>09/2014</created>
<author>dominique.aigroz@kadeo.net<author>
<example>
</example>
*/

#include "KSGM.h"
#include "KDamageType.h"


UKDamageType::UKDamageType(const FObjectInitializer& ObjectInitializer) 
	: Super(ObjectInitializer)
{
	// By default
	Physical = true;
	Type = EKDamageTypeEnum::KDT_Max;
	HitForceFeedback = nullptr;
	KilledForceFeedback = nullptr;
}



UKDamageType_Suicide::UKDamageType_Suicide(const FObjectInitializer& ObjectInitializer)
	: Super(ObjectInitializer)
{
}

This class is referenced in an USTRUCT

/**
* @brief FKWeaponConfig structure contains information
* 		 on the weapon configuration.
*/
USTRUCT()
struct FKWeaponConfig
{
	GENERATED_USTRUCT_BODY()

	/** current weapon state */
	EKWeaponState::Type CurrentState;

	/** is weapon fire active? */
	uint32 bWantsToFire : 1;

	/** time of last successful weapon fire */
	float LastFireTime;

	/** app time (FApp::GetCurrentTime()) of last successful weapon fire */
	double LastFireAppTime;

	/** The title for this config */
	UPROPERTY(EditDefaultsOnly, Category = WeaponStat)
	FText Title;

	/** time between two consecutive shots */
	UPROPERTY(EditDefaultsOnly, Category = WeaponStat)
	float TimeBetweenShots;

	/** type of damage */
	UPROPERTY(EditDefaultsOnly, Category = WeaponStat)
	TSubclassOf<UKDamageType> DamageType;

	/** @brief An array of alterations to apply to player hit by this damage type. */
	UPROPERTY(EditDefaultsOnly, Category = WeaponStat)
	TArray<struct FKCharacterAlteration> Alterations;

	/** the amount of power taken by this attack */
	UPROPERTY(EditDefaultsOnly, Category = WeaponStat)
	float PowerConsumption;

	/** weapon range */
	UPROPERTY(EditDefaultsOnly, Category = WeaponStat)
	float WeaponRange;

	/** if full damage must be applied. if not the damage are calculated progressively from the center point. */
	UPROPERTY(EditDefaultsOnly, Category = WeaponHUD)
	bool FullDamage;

	/** if the weapon supports targeting. */
	UPROPERTY(EditDefaultsOnly, Category = WeaponHUD)
	bool SupportTargeting;

	/** the icon texture used in the action bar for representing this config */
	UPROPERTY(EditDefaultsOnly, Category = ActionBar)
	TAssetPtr<UTexture2D> IconTexture;

	/** the configuration structure for animations */
	UPROPERTY(EditDefaultsOnly, Category = Animation)
	FKWeaponConfigAnim ConfigAnim;

	/** current weapon config type */
	UPROPERTY(EditDefaultsOnly, Category = General)
	EKWeaponConfigType ConfigCurrentType;

	/** the configuration structure for an instant damage like a bullet */
	UPROPERTY(EditDefaultsOnly, meta = (EditCondition = "DisplayInstantConfig"), Category = Config)
	FKWeaponConfigInstant Instant;

	/** Internal flag to show/hide the FKWeaponConfigInstant structure. */
	UPROPERTY()
	bool DisplayInstantConfig;

	/** the configuration structure for an instant damage like a missile */
	UPROPERTY(EditDefaultsOnly, meta = (EditCondition = "DisplayProjectileConfig"), Category = Config)
	FKWeaponConfigProjectile Projectile;

	/** Internal flag to show/hide the FKWeaponConfigProjectile structure. */
	UPROPERTY()
	bool DisplayProjectileConfig;

	/** the configuration structure for an instant damage like a spell */
	UPROPERTY(EditDefaultsOnly, meta = (EditCondition = "DisplaySpellConfig"), Category = Config)
	FKWeaponConfigSpell Spell;

	/** Internal flag to show/hide the FKWeaponConfigSpell structure. */
	UPROPERTY()
	bool DisplaySpellConfig;

	/** the configuration structure for an self team spell */
	UPROPERTY(EditDefaultsOnly, meta = (EditCondition = "DisplaySelfTeamConfig"), Category = Config)
	FKWeaponConfigSelfTeam SelfTeam;

	/** Internal flag to show/hide the FKWeaponConfigSelfTeam structure. */
	UPROPERTY()
	bool DisplaySelfTeamConfig;


	/**
	* @brief When the config type has changed.
	*/
	void OnWeaponConfigTypeChanged()
	{
		switch (ConfigCurrentType)
		{
			case EKWeaponConfigType::Instant:
			{
				DisplayInstantConfig = true;
				DisplayProjectileConfig = false;
				DisplaySpellConfig = false;
				DisplaySelfTeamConfig = false;
				// The instant config does not support targeting
				SupportTargeting = false;
				break;
			}
			case EKWeaponConfigType::Projectile:
			{
				DisplayInstantConfig = false;
				DisplayProjectileConfig = true;
				DisplaySpellConfig = false;
				DisplaySelfTeamConfig = false;
				break;
			}
			case EKWeaponConfigType::Spell:
			{
				DisplayInstantConfig = false;
				DisplayProjectileConfig = false;
				DisplaySpellConfig = true;
				DisplaySelfTeamConfig = false;
				break;
			}
			case EKWeaponConfigType::SelfTeam:
			{
				DisplayInstantConfig = false;
				DisplayProjectileConfig = false;
				DisplaySpellConfig = false;
				DisplaySelfTeamConfig = true;
				break;
			}
		}
	};

	/** defaults */
	FKWeaponConfig(EKWeaponConfigType InType = EKWeaponConfigType::Instant)
	{
		CurrentState = EKWeaponState::Idle;
		ConfigCurrentType = InType;
		DisplayInstantConfig = false;
		DisplayProjectileConfig = false;
		DisplaySpellConfig = false;
		bWantsToFire = false;
		FullDamage = false;
		SupportTargeting = false;
		TimeBetweenShots = 1.0f;
		PowerConsumption = 0.0f;
		WeaponRange = 10000.0f;
		DamageType = UKDamageType::StaticClass();
		LastFireTime = 0.0f;
		LastFireAppTime = 0.0f;
		// Apply right states based on the current config type
		OnWeaponConfigTypeChanged();
	}
};

IF I comment this line
DamageType = UKDamageType::StaticClass();
in the constructor, I can cook.

Any idea ?

Hello , what file is this UStruct being declared/defined in? If it isn’t in the .h of the KDamageType class, I would suggest trying that. You could also try forward declaring the UKDamageType class. As mentioned before, the error is saying that UKDamageType is being referenced before it has been added, so this a problem in the order.

Hello Matthew,
As you can see, I include the header file ==> #include “KDamageType.h”
Therefore, no need to do a forward declaration.

/**
 * @brief Interface of the KWeaponConfig class.
 *
 * @info Copyright (c) 2016 Kadeo. All rights reserved. 
 * 
 *         This source code is only intended as a supplement to the Kadeo User's Guide and
 *         related electronic documentation provided with the library. See these sources for
 *         detailed information regarding the Kadeo product.
 *
 * @author dominique.aigroz@kadeo.net
 * @date 19.03.2016
 *
 * @file D:\KadeoGames\UDK\KSGM\Source\KSGM\Objects\Weapons\KWeaponConfig.h
 */

#pragma once

#include "KDamageType.h"
#include "KAlterations.h"
#include "KBuffs.h"
#include "KWeaponConfig.generated.h"

/** @brief The weapon config type. */
UENUM(BlueprintType)
enum class EKWeaponConfigType : uint8
{
	Instant,
	Projectile,
	Spell,
	SelfTeam
};