How can I fill a shape made with line renderer with texture?,How to fill a shape with sprite renderer texture

I use line renderer to create shape in run mode.I need to fill shape with particular texture.How can I do it.Please help,I use a line renderer to create a shape in run time unity.I need to fill that shape with a particular texture.How can I do it.Please help

First of all you need to understand that technically you don’t have a shape to fill. Second, you need an object to put that texture on. However, if you have certain assumptions about your rendered lines you can fake it (such as they lie in a flat plane)… Put a plane gameobject where the lines are rendered. Now within a script create a copy of the texture you want to use. Essentially what you are going to do is draw those same lines (to scale) unto that texture using OLD-SCHOOL methods (you will have to do the leg work and write the code to do it yourself). Now instead of “filling” the shape you are actually going to change all the pixels outside the shape to transparent. Now, apply the texture to the material on the plane. Here are some methods you’ll need: texture2d.apply() texture2d.setpixel() The functions to actually draw the lines on the texture will need to be written by you.

Maybe Sprite Shape can solve this problem

At least it helped me in a similar situation

intro-to-2d-world-building-with-sprite-shape