So there is the solution iI have found.
Basically i hadI have many images one on top of another due to the ground textures in my 2d editor. And itsit is unnecessarily loading textures and creating objects in the game.
The solution is a post processing tool that iI have created. It does the following steps so you can incorporate it in your own engine:
Splits the map into chinkschunks and begin moving camera from one chunk to another.
Get all images in this chunk and order them by depth value in array (it can be Z value) Startingstarting from the bottom up.
Set all images to grayscale with a shader and set the alpha to 100% (so if there is transparency set this transparency to max).
Begin loopLoop through the images and for each image it does this
a) TintTints the image red
b) GetGets snapshot of the canvas (in my case) and check for red pixels inwithin some tolerance.
c) ifIf there is no pixels found destroyit destroys the image and deletedeletes it form the database.
I know this is very slow process that iI found, but itsit's offline and can be done nightly before builds. This cleans and removes any forgotten images that the players will never see but they sill will load in memory.
Hope this helps anyone.