- Home /
Unity 2D, Fit a texture/sprite to a specific shape/another sprite/polygon
I have a game where a spell can be many different types; Energy, Fire, Water... 16 total, but made to support more. The only issue so far is the sprites. So far, it's meant 16 different sprites in the shape of a circle. However, it would be nice to have other shapes, like squares, triangles, possibly even a list of vector points making a 2D mesh/polygon.
Is there a way I could have a square texture/sprite and crop or fit it to the desired shape? That way I could have 16 textures, but using cutout/crop, support a large number of shapes without having to redraw the sprites?
Currently the most similar post I have found is http://answers.unity3d.com/questions/624079/how-to-crop-or-mask-a-sprite-to-a-specific-shape.html , this has been a very hard thing to find online.
I have found one way to crop a texture/sprite using Rect, which would cut it out only in the form of a rectangle, not a triangle or other shapes.
maybe I can map the texture's uv points to match the vector points of the polygon collider?
(I mix texture and sprite together in this post, as I'm unsure which approach I need to take)
Your answer
Follow this Question
Related Questions
How to save lines/strokes? 1 Answer
SetPixel not working 1 Answer
Crop Texture2D - Get/Set Pixels 2 Answers
Resize Texture2D comes out grey 2 Answers