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 …

Sprites
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.

Box2D physics
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

Orthello 3.0 beta can be downloaded here

Posted on by mas | Leave a comment

Note, regarding Unity 2D 4.3

Regarding the upcoming Unity 4.3
(now in beta)

Will introduce 2D functionality with sprite slicing, texture packing (for Unity Pro) , a SpriteRenderer Component, 2D collider types and Box2D Physics…

I am in the process of beta testing and integrating Orthello with the new 2D engine of Unity 4.3. Orthello’s architecture proves to have an exact fit and integrates wonderfully with the new upcoming 2D functionality.

Without stepping in to much details, Orthello has definitely several benefits that extend over the new 2D Unity framework and by integrating Orthello with Unity2D, we are gonna provide you with one big ‘easy to use’ 2D framework.

To integrate, Orthello will introduce a new spriteType OTUnitySprite, that will be the Orthello container for a new 2D SpriteRenderer sprite, will support Box2DPhysics and the new collider types. Any Orthello sprite will keep having the benefits of the Orthello pooling system, tweening, drag and drop, OT.Over(), OT.Clicked, etc etc.

More detailed information about Orthello benefits and integration will follow as soon the 4.3 version of Unity will be released.

Posted in All | Leave a comment

Orthello 2.8.2

In this version we solved some bugs, expanded the tweening system, added delayed delegate execution and improved our multi-resolution (or skinning) support.

Continue reading

Posted in Orthello 2D Framework | Leave a comment

Orthello 2D framework attribution

We (here at WyrmTale games) are very proud that our free Orthello 2D Framework for Unity3D is being used by many people to create games or interactive applications in Unity3D. In addition, Orthello is also a nice way to start learning 2D programming in Unity3D.

We get lots of positive feedback and have about 75 downloads of the framework each day, adding up to about 2000 downlods a month.

But what about attribution?

Continue reading

Posted in Orthello 2D Framework, Unity3D | Leave a comment

2D Line Intersection in C#

To find an intersection point between to 2D lines use the following Math :

Line :   Ax+By = C

A = y2-y1
B = x1-x2
C = A*x1+B*y1

Now to find the intersection point :

float det = A1*B2 - A2*B1
    if(det == 0){
        //Lines are parallel
    }else{
        float x = (B2*C1 - B1*C2)/det
        float y = (A1*C2 - A2*C1)/det
    }

And now a method for Unity3D that takes Vector2 points to represent the 2 lines, and returns the intersection point;

Continue reading

Posted in Programming, Unity3D | Leave a comment

JSON formatting and parsing in Unity3D

Because I was working on a CouchDB class to manage data streams to and from CouchDB databases and Services like Cloudant, I had been searching for a good (and simple) JSON parser and formatter, that could integrate well with Unity3D.

Most .NET libs I encountered were a bit buggy, fatty or complex to use.

I encountered and really liked MiniJSON by Darktable
( Calvin Rien | https://gist.github.com/darktable/1411710 ).
It’s simple and you have total control.

However ..

Continue reading

Posted in Programming, Unity3D | Leave a comment