1
Support / Re: Are there any issues with NGUI + 2D Toolkit together?
« on: May 02, 2013, 06:53:51 pm »
Perfect. Thanks
This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
if (batcher.batchedSprites == null || batcher.batchedSprites.Length == 0)
{
if (GUILayout.Button("Commit"))
{
batcher.Commit();
EditorUtility.SetDirty(target);
}
}
public void Commit()
{
List<tk2dSprite> sprites = new List<tk2dSprite>();
tk2dSpriteCollectionData scd = null;
for (int i = 0; i < this.transform.childCount; ++i)
{
Transform t = this.transform.GetChild(i);
tk2dSprite s = t.GetComponent<tk2dSprite>();
if (s)
{
if (scd == null) scd = s.collection;
if (scd != s.collection)
{
Debug.LogError("Error: Multiple sprite collections found");
return;
}
if (scd.allowMultipleAtlases)
{
Debug.LogError("Error: Sprite collections with multiple atlases not allowed");
return;
}
sprites.Add(s);
}
}
// sort sprites, smaller to larger z
sprites.Sort((a, b) => b.transform.localPosition.z.CompareTo(a.transform.localPosition.z));
if (sprites.Count == 0)
{
Debug.LogError("Error: No child sprite objects found");
return;
}
this.spriteCollection = scd;
this.batchedSprites = new tk2dBatchedSprite[sprites.Count];
int currBatchedSprite = 0;
foreach (var s in sprites)
{
tk2dBatchedSprite bs = new tk2dBatchedSprite();
bs.name = s.gameObject.name;
bs.color = s.color;
bs.localScale = new Vector3(s.scale.x * s.transform.localScale.x, s.scale.y * s.transform.localScale.y, s.scale.z * s.transform.localScale.z);
bs.position = s.transform.localPosition;
bs.rotation = s.transform.localRotation;
bs.spriteId = s.spriteId;
bs.alwaysPixelPerfect = s.pixelPerfect;
this.batchedSprites[currBatchedSprite++] = bs;
GameObject.DestroyImmediate(s.gameObject);
}
this.Build();
}
- Integrated multi platform support (different atlases for different platforms, automatically loaded in)
- Animation editor upgrade (this is long overdue in my opinion, but generally, our workflow fits quite well with the way it is right now)
A nice, artist friendly, animation editor would be awesome!