I followed this answer: https://answers.unity.com/questions/1008644/semi-circle-2d-collider.html and was able to create a semicircle collider:

enter image description here

But is there any way I can just crop the circle sprite to make it a semicircle?

I tried looking for other documentation, but couldn't find any..

  • \$\begingroup\$ Though this statement may make me look like Captian Obvious, you could always draw a semicircle in an art program, import it to Unity, set it to a Sprite, and use it. That will save you alot of complicated programming (as shown in the answer by @LinkWindcrafter). \$\endgroup\$ – The Mattbat999 Nov 7 '17 at 3:48
  • \$\begingroup\$ @TheMattbat999 Would you be able to change the color and resize without losing resolution if you do that? \$\endgroup\$ – logic Nov 7 '17 at 3:50
  • \$\begingroup\$ Draw the semi circle white, then change the color in the Sprite Renderer on the sprite. Resolution, on the other hand, can be dealt with by setting the inport setting Bilinear to Point (No Filter), though you will need to draw the circle large, or it will look pixilated.w \$\endgroup\$ – The Mattbat999 Nov 7 '17 at 3:58

Mmmmm, maybe you could just crop the sprite on an image editor and then import it to unity. Seems like the most reasonable way to do it.

Or maybe you could generate on unity half the sprite with something like this:

    /// <summary>Converts Sprite to Texture2D.</summary>
    /// <param name="_sprite">Sprite to copy pixels from.</param>
    /// <returns>Texture2D with Sprite's pixels.</returns>
    public static Texture2D ToTexture(Sprite _sprite)
        Texture2D newTexture = new Texture2D((int)_sprite.rect.width, (int)(_sprite.rect.height / 2));

        Color[] pixels = _sprite.texture.GetPixels
            (int)(_sprite.textureRect.height / 2) /// Here you crop the sprite on half

        return newTexture;

But that's something you should do once, since it is expensive, and this is applied to a Texture2D, and not a sprite.


unity has a built in sprite editor...

  • 1
    \$\begingroup\$ This answer would be better if it explained how to use the built-in sprite editor to make a semi-circle sprite. \$\endgroup\$ – DMGregory Jan 10 at 13:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.