Garbage Collection of wrong reference

Magical error ahead.

My game has modes that are equipped by the player and then activated and deactivated by them; the player must have the mode equipped in order to activate it.

If I equip the mode, activate it, then stop PIE : nothing happens.

if I equip, activate, deactivate, then stop PIE: nothing happens.

If I equip, activate, deactivate, unequip, then stop PIE: nothing happens.

If I equip, activate, unequip (which automatically deactivates the mode), then stop PIE:

[2017.02.16-15.41.47:235][173]LogWindows:Error: Fatal error: [File:D:\Build\++UE4+Release-4.14+Compile\Sync\Engine\Source\Runtime\CoreUObject\Private\UObject\GarbageCollection.cpp] [Line: 547] 
[2017.02.16-15.41.47:235][173]LogWindows:Error: Invalid object in GC: 0x0000000047ec1d20, ReferencingObject: ParticleModuleColorOverLife /Game/Effects/Fire/fxp_Fire_Explosion01.fxp_Fire_Explosion01:ParticleModuleColorOverLife_5, ReferencingObjectClass: Class /Script/Engine.ParticleModuleColorOverLife, Property Name: Distribution, Offset: 200, TokenIndex: 7

OR

[2017.02.16-16.32.57:884][635]LogWindows:Error: Fatal error: [File:D:\Build\++UE4+Release-4.14+Compile\Sync\Engine\Source\Runtime\CoreUObject\Private\UObject\GarbageCollection.cpp] [Line: 547] 
[2017.02.16-16.32.57:884][635]LogWindows:Error: Invalid object in GC: 0x0000000047f9e380, ReferencingObject: CombatEffectBuff /Game/Developers//Talents/TestTalent.TestTalent:ActionDirect_20.CombatEffectBuff_69, ReferencingObjectClass: Class /Script/Resurgence.CombatEffectBuff, Property Name: Buffs, Offset: 56, TokenIndex: 6

TestTalent is a data asset with a TArray of instanced subobjects (including modes and direct actions); those subobjects themselves have instanced subobjects (eg combat effects) as well as references to other assets (eg particle effects).

The mode I’ve been testing with is one of TestTalent’s subobjects, the particle effect is referenced by a different subobject, and ActionDirect_20 is a third. To reiterate, these are three different subobjects of TestTalent. (Because it likely matters: in TestTalent’s array, the object with the particles is index 0, ActionDirect_20 is 1, and the mode is 2)

The second error message only appears when I remove the reference to the particle effect; when I re-add the reference, the first error message returns.

Regarding triggering the error, the auto-deactivation of the mode uses the same function as manually deactivating it.

Is there something that could cause the GC to somehow miss its target? And if so, how do I fix this?

Hi ,

Would it be at all possible to get a sample project that demonstrates this issue? The setup sounds somewhat complex, and I want to make sure I don’t miss any details in the process.

Spent some time narrowing things down by commenting out code. Seems the source of the error wasn’t anywhere near where I initially thought it was. Still can’t figure out why it’s trying and failing to garbage collect assets that weren’t involved in the first place, but I’ve found a way to bypass the issue that, so far, hasn’t created any new errors.

A sample project may take a while; even knowing where the error is, I’m still not certain on how many things I’d need to copy over to replicate the issue. The setup is somewhat complex.

Hi ,

I just wanted to check in on this and see if you are still running into this issue. Were you able to isolate it and get it working?

Hi ,

We have not heard back from you for a while. Do you still need help with this issue? I will be marking this post as resolved for internal tracking purposes, but please feel free to add a comment and re-open the post if you need any additional assistance.