Unity 2D vs 3D differences
Asked Answered
D

3

11

What are the main differences between Unity 2D project and unity 3D project! Does unity render faster 2D projects than 3D? Or does 2D prefabs/textures require less memory than 3D? Is there an option for creating 2D meshes in 2D projects?

Thank you for your time!

Diphyllous answered 15/6, 2014 at 10:54 Comment(3)
there isn't actually a specific 2D or 3D project per se, you can mix and match as you see fit in the same project (some restrictions apply, ie 2d physics can't interact with 3d physics)Trisomic
@LearnCocos2D so trere is no difference in memory or rendering speed between the two of them?Diphyllous
make a performance test with whatever you're worried about might not be fast enough. If you have no such use case it's absolutely pointless to consider rendering performance. At the end your game runs as fast as well as you program it to be, the underlying engine has very little to do with that (most engines are well optimized but may still have well known but very specific issues to avoid).Trisomic
B
14

The difference really lies in what kinds of objects you use in your scene and what camera you use. You can mix both 2D and 3D stuff in the same scene. Let me try to enumerate the differences when working with 2D and 3D:

  1. Camera: To get a 2D view of your world, you use an orthographic camera. With such camera you won't see the "perspective effect" of objects tapering away as they go farther away from the camera. A cube viewed from one side with an orthographic camera will be a square. The orthographic camera doesn't care about the distance of objects from the camera (as long as they are within the clipping plane of the camera)
  2. Sprites vs Meshes: You would generally use 2D sprites in a 2D game, attached to an object using the SpriteRenderer component. But you can also display 2D objects using textured quadrilaterals. In a 3D game, you would instead use the MeshRenderer component to display 3D meshes. You can, however, mix both kinds of contents in the same scene and achieve for example, a 2.5D effect.
  3. Physics2D vs Physics: Unity has two sets of physics tools: one for 3D and one for 2D. On a 2D game, it's easier to use the 2D physics tools: (RigidBody2D, Collider2D, related classes for scripting). For 3D games, you would use the 3D physics tools (RigidBody, Collider, and corresponding script classes). Note that you cannot mix 2D physics with regular physics, i.e., you cannot make a ball with CircleCollider2D bounce off of a box with BoxCollider.

Does unity render faster 2D projects than 3D?

Generally, yes, each 2D sprite can be thought of as a very simple flat 3D object (a textured quadrilateral with two triangles). It would render faster than a 3D character with thousands of triangles.

Is there an option for creating 2D meshes in 2D projects?

Sprites are what you would generally use for 2D; they are just rectangular pictures. A mesh is a 3D construct. You can import a flat mesh and orient it properly in a scene to make it look 2D.

Blouson answered 29/6, 2015 at 23:53 Comment(1)
Sprites are what you would generally use for 3D —is this a typo? Did you mean 2D?Tepee
E
3

There is not much difference. There are 2d meshes. The render speed depends on what components each object has mostly. In general though, 2d objects are faster as they don't need meshes, just sprites.

Elysian answered 15/6, 2014 at 18:34 Comment(0)
E
2

According to this (Unity 2D vs 3D), Unity 2D is always faster than 3D. I know the comparison is for Unity 4.3 but it is probably still relevant for Unity 5.

The above comparison is not an official benchmark done by Unity, so take it with a grain of salt? Probably the best way to be sure is to do the benchmark oneself...

Here is an excerpt from the blog:

So if you are developing 2D games today, there is no excuse for starting to use the new Physics engine. You’ll get better performance, meaning you’ll have more CPU time at your disposal to create even better games.

It is their word, not mine though.

Exponential answered 15/8, 2015 at 17:54 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.