The code in the screenshot above is a function (in the TileMapLayer node) to draw a rectangle/square based on a given width and height, but for some reason it is not showing up when running the game (just a blank screen).
Using print statements, I can see the program is going through the createShape function.
When I draw tiles manually before running the game, they will show up once the game is run.
The set_cell() method only works in the _ready function of the node.
I also tried set_cell() at the start of the createShape function and it does not work there either.
No errors are being produced when running the game.
Here is where the function is being called from just in case it’s important:
If you input an invalid source ID or invalid atlas coords, the function will erase the tile instead of placing one. Are you sure you’re using the right parameters?
Theoretically, the tiles could also be placed off screen (although that would only be the case if your tilemap had been moved), you can check by overriding the in-game camera:
I think it’s in the bottom screenshot on the original post. Though I might just be wrong about what adding a node to a scene tree means. Let me know if I am.
You need to call add_child(). You instantiate the node by calling new() on the script resource, but you need to add this node to the scene tree. Otherwise it won’t be drawn.