Shader Graph with Tilemaps (and Sprites)

Hi, I was hoping that I could put shaders on Tilemaps for various effects. Such as making an ocean tile wobble a little (with UV distortions?) or get lava to bloom, perhaps even to see if it’s possible to stretch out and loop a single big ground texture over several squares of a tilemap object to make the looping texture more seamless and simple to deal with.

But I’ve struggled with something as basic as getting a sprites-default kind of shader to work. It’s mostly since I’m unsure what to do and have a hard time to find help online.

However I finally got something that looks like it’s working fine, with normal sprites. But applying this to a tilemap makes my Editor crash, or turn the tilemap invisible. Perhaps a bit optimistic, does anyone have any advice what I could do or look for help for desired results? What is the bare minimum needed to make tilemaps simply display correctly with Shader Graphs?

This is an old question, however I just so happened to run into the same problem.
I am using Unity 2020.1.1.

  1. Firstly create a shader. In project : Create → Shader → 2D Renderer → Sprite Lit Graph (I think all graph types work).

  2. Add a Texture2D property, and make sure the reference is “_MainTex”. If it’s not it won’t work.

  3. Pass the property through a Sample Texture 2D node and into the Sprite Lit Master node.

  4. Create a new material.

  5. Add the shader to the newly created material.

  6. Now create the Tilemap, which is going to utilize the shader.

  7. Add the material to the Tilemap Renderer component, which is generated alongside the Tilemap.

Now you can modify the shader and the correct sprite should be displayed, because you referenced the Texture2D property as ‘_MainTex’.