Quantcast
Viewing latest article 23
Browse Latest Browse All 131

Any way to destroy internal classes that were instantiated?

I'm building a script that will instantiate some internal script when called. As in, public class Example : MonoBehaviour { private List newClassList = new List(); public void MakeNewClass() { newClassList.Add(new SomeClass()); } public void Activate() { foreach (NewClass class in newClassList) { class.DoSomething(); } } } internal class SomeClass : NewClass { // does something } Now, this function worked just fine... but the thing is, I worry that that would be best practice to do so. I am creating new class every time NewClass is created via new SomeClass(), but I never get to unload? or destroy? them. Whatever the correct term for that is. I am creating more and more classes without ever removing them, so I worry that this might cause some issue in the future. Is there anyway I can destroy internal classes? I can't seem to find a way to do that.

Viewing latest article 23
Browse Latest Browse All 131

Trending Articles



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