Question by
SlimBun · Mar 05, 2020 at 02:35 PM ·
c#colliderunity 2dcollider2d
How to set box collider to a gizmos cube size
Hello! I am trying make something in unity, and I need to set a box collider size to the size of a gizmos. How do I do it?
This is what I tried:
BoxCollider.GetComponent<BoxCollider2D>().size = centerGizmosCubeEndPos;
BoxCollider.GetComponent<BoxCollider2D>().offset = -sizeGizmosCubeEndPos;
Comment
Your answer
![](https://koobas.hobune.stream/wayback/20220612224426im_/https://answers.unity.com/themes/thub/images/avi.jpg)