- Home /
Is there any way of creating primitive 2D shapes in unity?
I have read the whole unity manual and watched the videos on sprites but I have a question. Is there any way of creating primitive 2D shapes in unity? (I will be assigning trigger colliders to these as well). Or does one need to have a 3rd-party program even for basic primitive 2D shapes? My game really is very minimalist.
I did think about using particle system in a clever way but that won't have triggers and may not be as memory efficient for the several basic shapes that I am after.
For your visuals use quads (Sprites). If you want a circle, use a Texture with a circle on it. You can still use colliders with shapes different from your visuals. If you want colliders different from the primitives use the PolygonCollider2D
Answer by Owen-Reynolds · Feb 12, 2015 at 04:29 PM
If you know the math, you can use the Mesh class to make anything you want, on the fly. Say you want a hexagon, where just one point stretches. Remaking your own mesh is about the only way to do that. Then, you can use the same mesh as a collider (for 3D, I assume for 2D.)
But you do have to learn how graphics cards store meshes, in order to use it (not that hard, but not easy.)
Can also use the Texture2D class to make set your own textures pixel-by-pixel. Again, if you know the math (how tall is an equilateral triangle of side length 1?)
But if they aren't going to change and esp. if you want tiny bits of "character" on them, it's probably easiest just to make textures in a free image program, like Gimp.
Your answer
Follow this Question
Related Questions
how to move child object inside a moving parent in 2d using Vector2.MoveTowards()? 1 Answer
How can i create multiplayer game using wifi hotspot in unity 0 Answers
Game for 2 players using 2 android devices 0 Answers
GDPR unity and Admob ads 0 Answers
LoadSceneAsync makes unity behave differently after build. 0 Answers