Hi. I am creating a 2d physics game and need some help with a feature I want. I use Playmaker for 90 % of my code but I can write scripts a bit, though I might need some help from time to time. Truth is I don’t know where to start with this one and I am hoping someone has an easy answer or can at least tell me where to start.
I will try to explain what I am after with the help of some pictures. This pic will describe my workflow that I have come up with. I use 1 tiled sprite for the background (black texture). And 1 tiled sprite for the walls (gold texture). I have many prefab wall shapes that have Sprite Masks components and Polygon Collider 2D components. The selected object is a instance of a curved wall prefab. All wall pieces are children of the Wall Composite Collider object which has an Composite Collider component attached.
Pic 1
Now what I want is a border drawn around the entire wall perimeter. In fact unity already does this it in the editor when I select the parent object as seen in the next picture. At first I thought unity drawing this was due to the composite collider. It is actually drawn due to the Spite mask children of this object. (The collider has a thin green border)
You can easily recreate this in a scene with an empty parent object and white shaped sprites with a sprite mask.
So what I want is a script I can attach to the parent object to draw that border at run time with public variables for color, and width. It seems like it should be simple because unity already does it in the editor but I have no idea where to start. Any ideas would be appreciated.
I had a previous post about this when I thought I would just draw the collider edge but then I noticed Unity was drawing that edge from the sprite mask. Using LineRender to draw edge of Composite Collider In Game