Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: gtoxast on October 15, 2012, 03:03:08 AM

Title: BUG: Reference Atlas Edit
Post by: gtoxast on October 15, 2012, 03:03:08 AM
When editing reference atlas type, changes is being normally applied to the original one.
But, because referenced atlas is not marked as dirty, it wouldn't be saved.

I fixed it in UIAtlas.cs by inserting following if statement at the start of MarkAsDirty function.

  1. public void MarkAsDirty ()
  2. {
  3.         if(mReplacement != null)
  4.         {
  5.                 mReplacement.MarkAsDirty();
  6.         }
  7.  
  8.  
  9.  

UPD: It did not fix the situation as i first thought.
Title: Re: BUG: Reference Atlas Edit
Post by: Nicki on October 15, 2012, 04:24:23 AM
Don't edit the reference atlas? :)
Title: Re: BUG: Reference Atlas Edit
Post by: ArenMook on October 15, 2012, 06:07:09 AM
I'll add this fix to the main repo, thanks.
Title: Re: BUG: Reference Atlas Edit
Post by: gtoxast on October 15, 2012, 06:42:57 AM
To Nicki:
It did edit the referenced one, but wouldn't save it

ArenMook:
Np, but I hope u noticed my UPD. =)
So check my solution before including it pls.

Also i d like to let u know, that i improved your Clipping View list.
So items colliders would be scaled and repositioned on the edge of the view panel and disabled when they got out.
If u interested, i can post the code in other topic.
Title: Re: BUG: Reference Atlas Edit
Post by: ArenMook on October 15, 2012, 07:22:11 AM
It's because you're missing:
  1. #if UNITY_EDITOR
  2.                 UnityEditor.EditorUtility.SetDirty(gameObject);
  3. #endif
Title: Re: BUG: Reference Atlas Edit
Post by: gtoxast on October 16, 2012, 09:33:25 AM
Ok, here is the full fix:

UIAtlas ->
  1.         public void MarkAsDirty ()
  2.         {
  3.                 if(mReplacement != null)
  4.             {
  5.                 mReplacement.MarkAsDirty();
  6.             }
  7.                
  8. #if UNITY_EDITOR
  9.         UnityEditor.EditorUtility.SetDirty(gameObject);
  10. #endif
  11.  

And in UIAtlasMaker -> static void UpdateAtlas (UIAtlas atlas, List<SpriteEntry> sprites)
its better to change
  1.  EditorUtility.SetDirty(atlas.gameObject);
with 
  1. atlas.MarkAsDirty();


Title: Re: BUG: Reference Atlas Edit
Post by: ArenMook on October 16, 2012, 10:42:45 AM
Yup, I've added these changes to the main repository, and I've made similar changes to the font class.