Page 1 of 1

Probable resource leak in EnemyBlood

Posted: Wed Jun 23, 2021 9:00 pm
by DunnyOfPenwick
The EnemyBlood component appears to create GameObjects for blood and sparkles but doesn't destroy them as the object transform.parent isn't attached to anything.

I am handling this in my own mod by creating my own ShowMagicSparkles() method with a coroutine that cleans up after itself.

Re: Probable resource leak in EnemyBlood

Posted: Thu Jun 24, 2021 2:28 am
by Interkarma
If you watch these objects in the scene, you will observe they are in fact destroyed. This does not require the transform to be attached to anything or to be removed externally. The object is perfectly capable of destroying itself through composition of components.

DaggerfallBillboard is the key component of these splash and sparkle gameobjects. This behaviour has a OneShot flag that indicates object should destroy itself when animation has completed. This happens in the animation coroutine of the behaviour itself and requires nothing extra to work. The object manages its own lifetime.

Re: Probable resource leak in EnemyBlood

Posted: Thu Jun 24, 2021 3:31 pm
by DunnyOfPenwick
Excellent, I can get rid of my extraneous code then.
I should have dug deeper into the code, the propery name 'OneShot' was the tell.