Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
Tags
(1 edit)

Thanks for your quick reply. You mean in for instance add it to Generated Level>Rooms>Walls?

While that probably would work on an existing level, but since you have to define the shape of the shadow caster manually (at least from what I know), it would not work in practice.

I was thinking it might work if you could add it directly to a single tile, then when you fuse corridors with rooms you could remove the shadowcasters from the colliding room tiles. No idea how to add it so a single tile though.

If you could somehow generate a Shadow caster that has the same shape of a shared wall tilemap layer, would probably be the best way.

Shadow casters are otherwise fairly simple to use, it does requires a Universal Render Pipeline project. This short video should help, link

edit: This guy seems to be on to something! link 

Will see if i can try this out later

(1 edit)

Ok tried the Tilemaps Shadow Caster in the second link. Could not get it to work with the generated shared walls tilemap layer. Or it actually generated shadow casters but they didn't show up. I did have to do this in play mode, so not sure if that's the problem

It does kind of work if you put it on each of the wall object inside a room template, but the same problem as before occurs when intersecting with corridors. The auto generated shadows are also not perfect.

Is there a reason why the auto-generated shadows are not perfect? I thought that it would just use the polygon tilemap collider and compute the precise shape of the walls. Do you need something more than that?

yeah I was hoping it would do that too. It doesnt seem to be able to handle a merged wall object that well. Not sure though. It looks like this: link

Oh, I see. I might try this myself but it might take at least 1-2 days to get to that.

Thank you, take your time :). 

So I’ve done a fair bit of research and it seems like the main problem is with shadows in enclosed areas (which the dungeon is). You can see a discussion here: https://forum.unity.com/threads/script-for-generating-shadowcaster2ds-for-tilemaps.906767/#post-7220347 . And as far as I know, these people do not have a working solution for this. However, someone from Unity replied there that in Unity 2021.2 it should be possible to access collider shape primitives and that it may be easier to fix these problems. I also tried working on my own solution but it’d require quite a lot of polishing and would also probably become obsolete soon as 2021.2 is already in its beta stage. So I’d probably recommend waiting for the new version of Unity where it should be easier to automatically generate the shadow caster shapes.

Ok, thank you for your research! Will hold off on that front until the new version.