Skip to content

CHL hook UnitPawnPostInitAnimTree is broken and passes a null parameter #1514

@furudee

Description

@furudee
simulated function DLCInfoPostInitAnimTree(SkeletalMeshComponent SkelComp)
{
	local array<X2DownloadableContentInfo> DLCInfos;
	local X2DownloadableContentInfo DLCInfo;
	local XGUnit Unit;
	local XComGameState_Unit UnitState;

	Unit = XGUnit(GetGameUnit());
	if (Unit != none)
	{
		UnitState = Unit.GetVisualizedGameState();
	}

	// Issue #212 use CHDLCHookManager
	DLCInfos = `DLCHOOKMGR.GetDLCInfos('UnitPawnPostInitAnimTree');
	foreach DLCInfos(DLCInfo)
	{
		DLCInfo.UnitPawnPostInitAnimTree(UnitState, self, SkelComp);
	}
}

This function is called in PostInitAnimTree event function in XComUnitPawnNativeBase, and PostInitAnimTree is called when a pawn is spawned with Spawn function
Issue is that this hook happens too early: because pawn is still spawning, it has no ObjectID, no UnitState, no GameUnit, so you can't retrieve the state from which this pawn was created from

Either somehow fix this hook or issue a disclaimer that UnitState parameter will always be none

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions