This is using a list of ground locations, no raycast is used.
Import the Tileset, Tilemap, and Animation bundle into your tilemap object.
In your game, make a new object and call it Export and place it in every level you have. Then Copy the List Export and Map Export into it.
In your tilemap object, go into your tileset bundle set the type for the map (leave 1 to map with other mapped objects). Set the same Type value in the Tilemap bundle where it says "type Search".
Go in the Export object on every level and rund the level, then press "Space" to get the level list in you clipboard. On every level, you will import the level list in the "Map Export". You will have many lists.
After getting a list from every level, connect the join inputs and outputs as shown already. Then run the game and press Enter to put the Master List in your clipboard.
Now into your tilemap object and go into the tilemap bundle, import and replace the list in that bundle. And then the Tilemap should be working if you set up the animation like I have.
You can delete the "Export" object from your game, and the "tileset" bundle in the tilemap object.