Soo is it better to have one library to clear every type of OOP object, or have a destroy function inside every class? i want to know what is more efficient
Every OOP object should have a :Destroy() function, if necessary. Though using library functions to make destroying objects easier is a very good idea if you have a lot of objects.
I’m worried that if i have one destroy function in every class that is specific to clear it 100% it will lag the game or make code inefficient, is this true? because using one library to clear stuff made it pretty much basic stuff and i sometimes needed to rewrite this library for more and more objects
You don’t have to worry about it unless you’re working with data heavy objects, and even then you can slowly delete them in the background to eliminate lag.
Soo the only possible problem is that if i use destroy function it will lag the game due to too much data being removed at the same time?
Yeah. And even then you can use some methods to run the deletion in the background slowly to remove lag.
yk, i was scared that having a lot of code in modules, for example if i have 20 classes i have 20 different destroy functions for each of them, will make code look bad and overall will make it less performant, thx for explaining