Recently Unity has released version 4.3 that adds, the much requested and awaited 2D functionality. In this post I will give a short description of this 2D system and explain why the Orthello 2D framework still has value when creating 2d games using Unity.
Unity 2D – what’s new …
Unity 2D introduces a new (2D) sprite object. A sprite object is created by setting the texture importer of an image in your project explorer to the new ‘Sprite’ import type.
You can select if the imported image contains a single sprite or multiple sprites, provide a packing Tag for the (Unity Pro only) auto texture packing feature and have some control of the pixel to units relation. You can also set the sprite’s pivot point.
After importing a sprite, you get a sprite object in your object explorer that holds the single or multiple sliced frames. If you created a sequence for an animation you can simply drop the sprite (frames) into a regular animation object to create an animating sprite and you control that animation through the Unity animation object.
To put the sprite or animating sprite into your (2D) scene, YES ! a new 2D editor view has been created that is basicly the same as the Orthello orthographic back view (how convenient), just drag in so a gameobject with a spriteRenderer is created linked to your sprite object.
You can specify the tint, give it a 2D sprite material and specify render order through a sorting layer and order within that layer. It is possible to create your own custom sort layers.
In addition to the functionality above, Unity Pro also has an auto texture packing feature ( still in development ) that will pack your sprites into optimized atlasses.
Unity 4.3 also comes with a Box2D physics implementation through the usage of the Collider2D, RigidBody2D, Physics2D etc components. This is proven 2D physics code but does not mix with the normal Physx components. In addition, simulating will only work when the 1 unit == 1 meter scale is used.
Orthello still an asset ?
Certainly! I will explain why ….
2D Framework vs Sprite Engine
Orthello is a 2D framework, where Unity2D is a sprite engine. Being a framework, Orthello tries to provide developers of 2D games/applications with types of functionality that will boost production.
In addition to the regular sprite stuff, orthello also covers (among others) things like : tweening, sound handling, multi-resolution support, data (reader) handling, debugging, object pooling, delayed code execution and quick sprite lookups.
Multiple sprite types
Because Unity2D sprites are images sliced (image focused), and the sliced mesh is (at this point in time) not accessable, it is not possible to create custom sprite types with dynamicly generated meshes/shapes using the new 2D sprite renderer.
Some useful Orthello custom sprite types (that are custom mesh based) : OTTextSprite, OTGradientSprite, OTFilledSprite, OTClippedSprite, OTCircleSprite, OTGridSprite.
Atlas import support
Orthello support import/integration of many types of atlasses that you can create with your favorite 3dParty Atlas tool. This way you have total control of your atlasses and can update art quickly just by re-publishing your atlasses from, for example, texture packer.
Sprite Batching and other Pro features
Where sprite batching with texture packing is a Unity Pro feature, Orthello Pro, also usable in Unity Indie has sprite batching functionality to boost performance and Tilemap functionality (among others).
Unity2D Sprite Renderer integration
To enjoy both worlds, we integrated the new Unity 2D sprites using the new OTUnitySprite object. Just drag it into your scene and link it to your sliced sprite and you can use this new sprite system while still keeping all benefits and functionality that is delivered through our Orthello 2D framework.
Important to note :
- All Orthello sprite types (including OTUnitySprite) can use the Physx system or the new Box2D physics system. ( sprite.box2DPhysics = true )
- Sprites that use Box2D physics will not interact with sprites that use Physx.
- Box2D will only simulate correctly when 1 unit == 1 meter, so within orthello you will have to work with a OT.view.customSize and very small objects. 1 unit == 1 pixel (orthello default) will not work.
- Orthello objects use the default sort layer (id==0) and sort order 0. This can be set/changed on the renderer