Probable resource leak in EnemyBlood

Post here if you need help getting started with Daggerfall Unity or just want to clarify a potential bug. Questions about playing or modding classic Daggerfall should be posted to Community.
Post Reply
User avatar
DunnyOfPenwick
Posts: 275
Joined: Wed Apr 14, 2021 1:58 am
Location: Southeast US

Probable resource leak in EnemyBlood

Post 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.

User avatar
Interkarma
Posts: 7234
Joined: Sun Mar 22, 2015 1:51 am

Re: Probable resource leak in EnemyBlood

Post 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.

User avatar
DunnyOfPenwick
Posts: 275
Joined: Wed Apr 14, 2021 1:58 am
Location: Southeast US

Re: Probable resource leak in EnemyBlood

Post 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.

Post Reply