Author Topic: [Guide] How to put the "New Sprite" button back in  (Read 2356 times)

kasplask

  • Guest
[Guide] How to put the "New Sprite" button back in
« on: April 10, 2013, 10:27:54 PM »
I just did a long rant about how the clone sprite button should be put back in, but i just found out how to do it.
Luckily, the code is still in there, it's just commented out.
Just go to this bit in the UIAtlasInspector.cs and remove the /* and */ to uncomment it.

  1. // This functionality is no longer used. It became obsolete when the Atlas Maker was added.
  2. /*NGUIEditorTools.DrawSeparator();
  3.  
  4. GUILayout.BeginHorizontal();
  5. {
  6.         EditorGUILayout.PrefixLabel("Add/Delete");
  7.  
  8.         if (GUILayout.Button("Clone Sprite"))
  9.         {
  10.                 NGUIEditorTools.RegisterUndo("Add Sprite", mAtlas);
  11.                 UIAtlas.Sprite newSprite = new UIAtlas.Sprite();
  12.  
  13.                 if (mSprite != null)
  14.                 {
  15.                         newSprite.name = "Copy of " + mSprite.name;
  16.                         newSprite.outer = mSprite.outer;
  17.                         newSprite.inner = mSprite.inner;
  18.                 }
  19.                 else
  20.                 {
  21.                         newSprite.name = "New Sprite";
  22.                 }
  23.  
  24.                 mAtlas.spriteList.Add(newSprite);
  25.                 mSprite = newSprite;
  26.         }
  27.  
  28.         // Show the delete button
  29.         GUI.backgroundColor = Color.red;
  30.  
  31.         if (mSprite != null && GUILayout.Button("Delete", GUILayout.Width(55f)))
  32.         {
  33.                 mConfirmDelete = true;
  34.         }
  35.         GUI.backgroundColor = Color.white;
  36. }
  37. GUILayout.EndHorizontal();*/
  38.  
« Last Edit: April 10, 2013, 10:33:21 PM by kasplask »

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: [Guide] How to put the "New Sprite" button back in
« Reply #1 on: April 11, 2013, 10:54:01 AM »
Yup, precisely why I left it in there. Just beware that you're using it at your own risk. Adding sprites this way may be incompatible with using the atlas maker afterwards.