Transparent cutout SSAO problem

I am creating a 2D game and started adding SSAO to make the edges of object clearer but it doesn’t seem to work well with the transparent cutout material

This is what I get:

43555-ssao.png

I want the ambient occlusion to surround the player itself rather than the plane the texture is on.

I had a similar problem and managed to figure it out, so if anybody else ever ends up here, maybe this can be of any help:

Unity’s SSAO effect will re-render the objects in the scene to a depth map using different versions of the SSAO shader, according to the RenderType of the objects’ shaders (in my case, “TransparentCutout”).

This SSAO shader pass expects the texture used for the alpha cutout to be bound to the _MainTex of the object’s shader. In my case, it was in another custom texture. Switching the two textures out and having _MainTex hold the alpha cutout meant that the SSAO shader could render it properly to its depth map and the problem was fixed.