Author Topic: UIAtlasMaker exception  (Read 28879 times)

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: UIAtlasMaker exception
« Reply #30 on: September 05, 2013, 05:02:00 AM »
I never said the bug does not exist. This post shows that it does for some rare individuals. I simply said I cannot fix what I cannot reproduce. If you post clear steps on how I can reproduce it starting from a clean NGUI project, I will fix it, guaranteed.

I used Unity 4.2.1 in that video.

Gorgor

  • Guest
Re: UIAtlasMaker exception
« Reply #31 on: September 05, 2013, 10:30:43 AM »
Today we found out that we are getting similar error:

  1. MissingReferenceException: The object of type 'Texture2D' has been destroyed but you are still trying to access it.
  2. Your script should either check if it is null or you should not destroy the object.
  3. UnityEngine.Texture.get_width ()
  4. UITexturePacker.PackTextures (UnityEngine.Texture2D texture, UnityEngine.Texture2D[] textures, Int32 width, Int32 height, Int32 padding, Int32 maxSize) (at Assets/NGUI/Scripts/Editor/UITexturePacker.cs:89)
  5. UIAtlasMaker.PackTextures (UnityEngine.Texture2D tex, System.Collections.Generic.List`1 sprites) (at Assets/NGUI/Scripts/Editor/UIAtlasMaker.cs:142)
  6. UIAtlasMaker.UpdateTexture (.UIAtlas atlas, System.Collections.Generic.List`1 sprites) (at Assets/NGUI/Scripts/Editor/UIAtlasMaker.cs:526)
  7. UIAtlasMaker.UpdateAtlas (.UIAtlas atlas, System.Collections.Generic.List`1 sprites) (at Assets/NGUI/Scripts/Editor/UIAtlasMaker.cs:617)
  8. UIAtlasMaker.UpdateAtlas (System.Collections.Generic.List`1 textures, Boolean keepSprites) (at Assets/NGUI/Scripts/Editor/UIAtlasMaker.cs:600)
  9. UIAtlasMaker.OnGUI () (at Assets/NGUI/Scripts/Editor/UIAtlasMaker.cs:921)
  10. System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at /Applications/buildAgent/work/b59ae78cff80e584/mcs/class/corlib/System.Reflection/MonoMethod.cs:222)

I try to update NGUI to the 2.6.5b from Asset store but it solved nothing:(.. We are using unity 4.1.2 on Macs.
It definitely worked few days ago.. unfortunately I don't know what happened:(
As devfo said - I can create new atlas.. but I can not update it:(

Gorgor

  • Guest
Re: UIAtlasMaker exception
« Reply #32 on: September 05, 2013, 10:49:44 AM »
Hi,
I tried few versions back in SVN and tracked that problem.. Now I can confirm that my problem starts when I import into my project (already with NGUI) package named "Uni2D". It reports no errors and Uni2D works fine.. but NGUI becomes unable to update its own atlases... :(

EDIT:
After deleting Uni2D directory.. NGUI works again..
Hey guys.. you should really cooperate.. both packages seem super cool.. I do NOT want to be forced to choose one of them..

EDIT2:
Seems I am not the first one that found out that coexistence with Uni2D is problematic
http://www.tasharen.com/forum/index.php?topic=5287.0
« Last Edit: September 05, 2013, 11:50:50 AM by Gorgor »

FodderMK

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 1
    • View Profile
Re: UIAtlasMaker exception
« Reply #33 on: September 05, 2013, 12:41:48 PM »
I was having a similar problem.  The solution for me was to create a new, empty scene before I tried to manipulate the atlas.  Everything seemed to work as long as I didn't have a scene open that used atlas assets.  It's mildly irritating to close/reopen scenes in order to change my atlas but at least I can continue working.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: UIAtlasMaker exception
« Reply #34 on: September 05, 2013, 08:32:12 PM »
Uni2D must be doing something with the textures that's causing them to get unloaded. Maybe it modifies the texture importing process? I'd post a bug on the Uni2D support forum.

Or just use Unity 4.3 beta. It already has native 2D support, so Uni2D, 2D Toolkit, ex2D, etc all become obsolete.

devfo

  • Guest
Re: UIAtlasMaker exception
« Reply #35 on: September 11, 2013, 12:41:58 AM »
I also am using Uni2D. OK, sounds like this is the issue. Thanks for clearing this up guys...

Muxeu

  • Guest
Re: UIAtlasMaker exception
« Reply #36 on: September 25, 2013, 07:00:42 AM »
Hi everyone ! A also catch this bug at my project. I fixed it by adding this line:
  1. sprite.tex.hideFlags = HideFlags.HideAndDontSave;
at UIAtlasMaker class in function ExtractSprites after this lines:
  1. SpriteEntry sprite = new SpriteEntry();
  2. sprite.name = asp.name;
  3. sprite.temporaryTexture = true;
  4. sprite.tex = new Texture2D(newWidth, newHeight);

It works for me ! Looks like unity gc clear textures after reimporting main atlas at this line:
  1. // The atlas no longer needs to be readable
  2. NGUIEditorTools.ImportTexture(atlas.texture, false, false);

Sorry for my bad english.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: UIAtlasMaker exception
« Reply #37 on: September 25, 2013, 07:36:34 PM »
I'd be concerned with that potentially leaking memory since the textures wouldn't be marked as "don't save".

Muxeu

  • Guest
Re: UIAtlasMaker exception
« Reply #38 on: September 26, 2013, 01:28:25 AM »
I'd be concerned with that potentially leaking memory since the textures wouldn't be marked as "don't save".

It's better than non-working atlas maker. At my large project maker not working at all without this fix (empty scenes and other hacks doesn't help). I am not using Uni2D or other toolkits.

As i see, maker crash only at large project and large atlases (my atlas 2048x2048, about 100 sprites). At small and new atlases works fine.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: UIAtlasMaker exception
« Reply #39 on: September 26, 2013, 03:52:56 PM »
As Uni2D maker mentioned in the other thread, this problem gets fixed on Uni2D side in the next update.

wcoastsands

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 5
    • View Profile
Re: UIAtlasMaker exception
« Reply #40 on: March 03, 2014, 08:51:45 AM »
I get this error consistently when making 4k atlases (120 sprites each). Issue would occur when adding/updating an atlas. Was able to get around it by hitting the replace button, but now that that button has been removed in recent updates, I can't work around the issue anymore. The Updating window also remains on screen, making it impossible to do much with Unity other than force quit and try again.

Running Unity 4.3.4 with NGUI 3.5.3 on OSX 10.9.2 with 16GB Ram.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: UIAtlasMaker exception
« Reply #41 on: March 03, 2014, 11:10:14 PM »
Can you send me your atlas and the sprite you're trying to add so I can look into this? You can either attach it here or email me the download link to support at tasharen.com.

wcoastsands

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 5
    • View Profile
Re: UIAtlasMaker exception
« Reply #42 on: March 04, 2014, 06:14:21 AM »
Just emailed you a download link. Thanks!

Acheron Studio

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 2
    • View Profile
Re: UIAtlasMaker exception
« Reply #43 on: March 04, 2014, 05:17:55 PM »
So I just got this issue today. It seems to have sorted itself out, so I can only supply what I 'think' I did, and what I think might potentially be the issue.

Here's the original story:
My textures were of Texture Type: GUI
My resulting atlas was of 2k x 4k (considered 'large' when it gets to around 4k)
It would halt on the updating bar while also throwing the error about Texture2D.

Here were 2 things I did that seemed to fix it (not suggesting it's the solution, just saying that after I did these, it worked. Might  be a clue):
I changed my textures to be of type Advanced and made sure Non power of 2 was set to None.
I added one less texture so that my resulting atlas was only of size 2k x 2k

I'm not using Uni2D or anything like that. I'm on the latest version of Unity and NGUI - or at the very least, on a very recent version.

Hope this helps. Cheers.

EDIT:

Completely disregard what I said. Apparently this still happens.

However I can confirm that clicking the Add/Update All button again after it was halting on the Updating progress bar did in fact complete the Atlas.
« Last Edit: March 04, 2014, 05:41:22 PM by Acheron Studio »

biggsthecat

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 2
    • View Profile
Re: UIAtlasMaker exception
« Reply #44 on: March 20, 2014, 11:19:18 AM »
Hey, I'm using version 3.4.9 and I'm having a similar issue trying to update the atlas. I'm trying to make an equipment inventory atlas and I keep getting an error saying:

"MissingReference Exception: The object of type 'Texture2D' has been destroyed but you are still trying to access it"

after trying to update. The atlas maker also never finished updating the atlas. It gets to the end of the loading bar, and stops so I can click Add/Update again. Once or twice, clicking the update button again will add the image to the atlas, but more often than not it will restart the update bar and never finish the update.

When it works fine, it moves onto a "Hold On" Loading bar, and adds the image from it's destination folder.

 I've read through many of the atlas maker posts and have found nothing that consistantly works. I've tried waiting for longer times, clicking add/update multiple times, and adding the short line of script to the UI Atlas Maker script:

"sprite.tex.hideFlags = HideFlags.HideAndDontSave;"

as posted by Muxeu but it's made no difference. I've also tried it on different computers and it makes no change. Any assistance would be appreciated.