Firstly, can I say that I love this tool. I can only find one area of complaint and I am going to post a work-around.
I am using the top-down 2D format.
This works great, except when my characters are made up of multiple sprites and animated in unity. The existing code changes all the orders to the same (which of cause causes issues).
The only work-around I can figure is putting a script on the child sprites to remember their original offsets and then calling on this script in the followsortingmap.cs file.
using UnityEngine;
using System.Collections;
public class InitalOffset : MonoBehaviour
{
public int initalOffset;
// Use this for initialization
void Awake ()
{
if (GetComponent <SpriteRenderer>())
{
initalOffset = GetComponent <SpriteRenderer>().sortingOrder;
}
else
{
initalOffset = 0;
}
}
}
and then adding
public void GetOffset (GameObject obj)
{
//Debug.Log ("GetOffset called.");
if (obj.GetComponent <SpriteRenderer>())
{
if (obj.GetComponent <InitalOffset>())
{
offset = obj.GetComponent <InitalOffset>().initalOffset;
}
}
else
{
offset = 0;
}
}
to followsortingmap.cs.
You obviously need to call it in the renderers array, but it works.
I am wondering if there is consideration to include the ability to have multiple offsets in the script in the future?
-Armada / Dave
Comments
If your characters involve multiple sprites, just add a FollowSortingMap script to each sprite object. If you check the "Offset original order" box, the initial offset will be maintained.
If not, I'll look into it. I appreciate you posting the workaround - but I'd like to know if the intended method isn't working for you.