How to apply a repeating texture to a non-square sprite

Its seems like I am overthinking this or assuming this is easier than it is.

I have a square repeating texture and I am trying to apply it to a circle sprite in Unity. My goal is to enlarge the circle sprite and have the texture repeat across the circle allowing me to resize it at any time. I can do this with a square sprite simply by dragging into the scene and setting the draw mode to repeat. I created a circle sprite in Unity via Create>Sprites>Circle. I tried creating a material out of my tiled sprite but the standard material gives me a semi-transparent circle when I set the Albedo to my image. I assume this has to do with using this material on a sprite renderer.

The behavior I am looking for is much the same as filling an area in Gimp or other image editing programs. Regardless of the shape of the area I can fill it with a pattern. I assumed the repeating texture would work like this in unity but I have to create a circle image to get a circle in the first place and that Unity-created white circle image is the image used for the sprite.

I assume I will need a custom shader or a cutout sprite so my repeating square texture can appear as a circle but this seems like something that should be more trivial than either of these.

Is there an easier way to do this?

Thanks

Luckily for you I made a Shader Graph to do something very similar recently. This should get you 90% of the way there. I very quickly modified what I had. Untested, but should work immediately or with small tweaks.

MainTex is the repeatable texture. Make sure on the Texture Importer you check that it is set to repeat correctly rather than clamp. If you want to scale up or scale down the repeated texture, you’d change the Tiling and Offset node’s Tiling floats.

The second texture, shadow, can be whatever you want. Its alpha defines the shape of that the MainTex is repeated in.

6480351--727992--Cap2 - Copy.png

There’s also a ColorLine property that defines an HDR color to recolor the MainTex.

Usage: plug into SpriteRenderer than adjust its Transform scale to resize the “shadow” texture. The sprite assigned to the SpriteRenderer supplies the MainTex.

If it’s more sensible for your use case, you could swap MainTex and Shadow so that the SpriteRenderer supplies the shape (circle, square, pentagon) in which the repeating texture repeats.

Oh wow thanks Lo-renzo! I will check it out and see if I have any issues.