How can I contain a gameobject within 2d edge colliders?

I am trying draw a custom shape with edge colliders, I could draw it with a polygon collider as well, but I am unsure of how to ‘contain’ an object within the colliders. For example, if I draw a square with 4 edge colliders and put a circle collider inside, I want to be able to drag that circle with a mouse but only within the square. Keep in mind my custom shapes will be much more complicated than a square.

It sounds like what you’re doing is incredibly wrong. Explain what you’re actually doing (ie, “it’s a tank game” or “I’m moving color squares around in a 2D puzzle” or “I’m using the gui” etc)

it’s possible this could help … Resizing a gameobject based on mouse position - Unity Answers

also How do I permanently resize a model with children? - Unity Answers