Quantcast
Channel: Questions in topic: "dynamically"
Viewing all articles
Browse latest Browse all 152

Run-time generated AnimationClips leaking

$
0
0
I currently create AnimationClips dynamically while my game is running to move some pieces around. You can see what I mean here: [https://youtu.be/u1My9JX4K-c?t=8s][1] , when the pieces get grouped together and then open again. I cannot reuse the clip because the pieces will have a different position next time, so all the movements need to be changed. Right now, I create a new clip whenever I need them to be grouped and separated, and attempt to replace any existing clip with this: private void ReplaceAndPlay(AnimationClip clip, string name) { var old = Anim.GetClip(name); if (old != null) { Anim.RemoveClip(name); Destroy(old); } Anim.AddClip(clip, name); Anim.Play(name); } (Anim just points to the gameObject's Animation component) But using the profiler, I see that the animation clips just keep accumulating, they don't seem to be garbage collected. Am I missing something or doing something wrong? Can they be garbage collected? [1]: https://youtu.be/u1My9JX4K-c?t=8s

Viewing all articles
Browse latest Browse all 152

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>