CS2D
Scripts
freeimage() vs killobject()
freeimage() vs killobject()
1 reply Is there any difference between
freeimage and
killobject when it comes to removing an image? I know the fact that unlike
freeimage,
killobject triggers
objectkill hook. But I wonder if there is anything going on in the background.
I have been trying to get an answer to this via Discord but apparently nobody has any answer yet. DC Admin
Offline
Yes, there are differences.
killobject does checks related to killing other objects than images, especially buildings. Like rewards, punishments and effects when killing a building. It does NOT remove tweens associated with the image.
freeimage does not do all these checks but only removes tweens associated with that image.
So when using both with images the main difference is that tweens are not removed with
killobject. This is most likely nothing you want to happen. Therefore I recommend to just always use
freeimage to remove images and not
killobject.
There most likely isn't any relevant difference in peformance/traffic.