Author Topic: Atlasmaker / Fontmaker problem  (Read 12068 times)

P40Pban

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 2
    • View Profile
Atlasmaker / Fontmaker problem
« on: June 11, 2014, 02:58:37 PM »
I Have a standard NGUI Licence

This problem happens is in a existing Project where I have deleted NGUI and updated as indicated in the documentation;
When I do this in a New project it works fine and aslo If I add the font to one off the Example Atlases of NGUI in the existing project it also works fine.

These are the steps as what I did

I Create a new Altlas with the Atlas maker which gets created but give this Error after Creation

importer.GetNPOTScale() == TextureImporter::kNPOTKeep
UnityEditor.AssetDatabase:ImportAsset(String, ImportAssetOptions)
NGUIEditorTools:MakeTextureAnAtlas(String, Boolean, Boolean) (at Assets/NGUI/Scripts/Editor/NGUIEditorTools.cs:492)
NGUIEditorTools:ImportTexture(String, Boolean, Boolean, Boolean) (at Assets/NGUI/Scripts/Editor/NGUIEditorTools.cs:506)
UIAtlasMaker:UpdateTexture(UIAtlas, List`1) (at Assets/NGUI/Scripts/Editor/UIAtlasMaker.cs:569)
UIAtlasMaker:UpdateAtlas(UIAtlas, List`1) (at Assets/NGUI/Scripts/Editor/UIAtlasMaker.cs:675)
UIAtlasMaker:UpdateAtlas(List`1, Boolean) (at Assets/NGUI/Scripts/Editor/UIAtlasMaker.cs:658)
UIAtlasMaker:OnGUI() (at Assets/NGUI/Scripts/Editor/UIAtlasMaker.cs:1007)
UnityEditor.DockArea:OnGUI()

I then Create a new Font with Font Maker Using this atlas which create the font but gives the same type error !

importer.GetNPOTScale() == TextureImporter::kNPOTKeep
UnityEditor.AssetDatabase:ImportAsset(String, ImportAssetOptions)
NGUIEditorTools:MakeTextureAnAtlas(String, Boolean, Boolean) (at Assets/NGUI/Scripts/Editor/NGUIEditorTools.cs:492)
NGUIEditorTools:ImportTexture(String, Boolean, Boolean, Boolean) (at Assets/NGUI/Scripts/Editor/NGUIEditorTools.cs:506)
NGUIEditorTools:ImportTexture(Texture, Boolean, Boolean, Boolean) (at Assets/NGUI/Scripts/Editor/NGUIEditorTools.cs:525)
UIAtlasMaker:ExtractSprites(UIAtlas, List`1) (at Assets/NGUI/Scripts/Editor/UIAtlasMaker.cs:516)
UIAtlasMaker:AddOrUpdate(UIAtlas, Texture2D) (at Assets/NGUI/Scripts/Editor/UIAtlasMaker.cs:616)
UIFontMaker:OnGUI() (at Assets/NGUI/Scripts/Editor/UIFontMaker.cs:480)
UnityEditor.DockArea:OnGUI()

When I use the Modifier to add Shadows I get this exception (See Below)  and the Updating the atlas remains on screen even after the error you can now interact again with Unity but do get rid of the Updating window I have to close Unity Editor!

UnityException: Texture 'MainMenuAtlas' is not readable, the texture memory can not be accessed from scripts. You can make the texture readable in the Texture Import Settings.
UnityEngine.Texture2D.GetPixels32 () (at C:/BuildAgent/work/aeedb04a1292f85a/artifacts/EditorGenerated/TextureBindings.cs:255)
UIAtlasMaker.ExtractSprites (.UIAtlas atlas, System.Collections.Generic.List`1 finalSprites) (at Assets/NGUI/Scripts/Editor/UIAtlasMaker.cs:508)
UIAtlasMaker.AddOrUpdate (.UIAtlas atlas, UnityEngine.Texture2D tex) (at Assets/NGUI/Scripts/Editor/UIAtlasMaker.cs:616)
UIFontInspector.ApplyEffect (Effect effect, Color foreground, Color background) (at Assets/NGUI/Scripts/Editor/UIFontInspector.cs:652)
UIFontInspector.OnInspectorGUI () (at Assets/NGUI/Scripts/Editor/UIFontInspector.cs:353)
UnityEditor.InspectorWindow.DrawEditor (UnityEditor.Editor editor, Int32 editorIndex, Boolean forceDirty, System.Boolean& showImportedObjectBarNext, UnityEngine.Rect& importedObjectBarRect, Boolean eyeDropperDirty) (at C:/BuildAgent/work/aeedb04a1292f85a/Editor/Mono/Inspector/InspectorWindow.cs:1124)
UnityEditor.DockArea:OnGUI()

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Atlasmaker / Fontmaker problem
« Reply #1 on: June 12, 2014, 02:23:20 AM »
Haven't seen this myself or heard of others having it, but doing a google search reveals that it's some bug in 4.5:

http://answers.unity3d.com/questions/721363/unity-45-error.html

Regarding "UnityException: Texture 'MainMenuAtlas' is not readable" -- this means that the texture cannot be edited. This may be due to its file being marked as read-only, or being in some protected location like c:\program files, or using a versioning system that locks files such as CVS. Or it may simply be related to the first issue.

I suggest checking the import settings on the atlas texture and comparing them to the atlas textures that come with NGUI.

P40Pban

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 2
    • View Profile
Re: Atlasmaker / Fontmaker problem
« Reply #2 on: June 12, 2014, 08:13:30 AM »
Thank you for the promt response.

I have aslo created a new folder with only a few images which would then be reimported if I am not mistaken.
I then used this folder to create a new atlas in my existing project and still the same problem.

As said when I use the same images and start a brand new project and then create an atlas I do not have any problems

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Atlasmaker / Fontmaker problem
« Reply #3 on: June 13, 2014, 03:52:58 AM »
If it works in a brand new project but doesn't work in your current one, then that points to a configuration issue -- build settings, quality settings, etc.

FizzPow

  • Jr. Member
  • **
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 83
    • View Profile
    • FizzPow Games
Re: Atlasmaker / Fontmaker problem
« Reply #4 on: June 25, 2014, 01:33:38 PM »
Just updated to latest Unity 4.5.1f3 and NGUI 3.6.5 and now getting the same error whenever I update atlas, it also corrupted my atlas so all existing sprites turned into beige squares.  I had to rebuild it all again.  It seems to work now that I rebuilt it, but I still get the error every time I update it.

I tried a Reimport-All, no change.  I suppose other than the annoyance of having to rebuild my atlas, it's not causing other issues that I can tell so far.  Here is my error for reference:

I get these two each time I update:

  1. importer.GetNPOTScale() == TextureImporter::kNPOTKeep
  2. UnityEditor.AssetDatabase:ImportAsset(String, ImportAssetOptions)
  3. NGUIEditorTools:MakeTextureAnAtlas(String, Boolean, Boolean) (at Assets/NGUI/Scripts/Editor/NGUIEditorTools.cs:493)
  4. NGUIEditorTools:ImportTexture(String, Boolean, Boolean, Boolean) (at Assets/NGUI/Scripts/Editor/NGUIEditorTools.cs:507)
  5. UIAtlasMaker:UpdateTexture(UIAtlas, List`1) (at Assets/NGUI/Scripts/Editor/UIAtlasMaker.cs:569)
  6. UIAtlasMaker:UpdateAtlas(UIAtlas, List`1) (at Assets/NGUI/Scripts/Editor/UIAtlasMaker.cs:675)
  7. UIAtlasMaker:UpdateAtlas(List`1, Boolean) (at Assets/NGUI/Scripts/Editor/UIAtlasMaker.cs:658)
  8. UIAtlasMaker:OnGUI() (at Assets/NGUI/Scripts/Editor/UIAtlasMaker.cs:1011)
  9. UnityEditor.DockArea:OnGUI()
  10.  

  1. importer.GetNPOTScale() == TextureImporter::kNPOTKeep
  2. UnityEditor.AssetDatabase:ImportAsset(String, ImportAssetOptions)
  3. NGUIEditorTools:MakeTextureAnAtlas(String, Boolean, Boolean) (at Assets/NGUI/Scripts/Editor/NGUIEditorTools.cs:493)
  4. NGUIEditorTools:ImportTexture(String, Boolean, Boolean, Boolean) (at Assets/NGUI/Scripts/Editor/NGUIEditorTools.cs:507)
  5. NGUIEditorTools:ImportTexture(Texture, Boolean, Boolean, Boolean) (at Assets/NGUI/Scripts/Editor/NGUIEditorTools.cs:526)
  6. UIAtlasMaker:ExtractSprites(UIAtlas, List`1) (at Assets/NGUI/Scripts/Editor/UIAtlasMaker.cs:516)
  7. UIAtlasMaker:UpdateAtlas(List`1, Boolean) (at Assets/NGUI/Scripts/Editor/UIAtlasMaker.cs:648)
  8. UIAtlasMaker:OnGUI() (at Assets/NGUI/Scripts/Editor/UIAtlasMaker.cs:1011)
  9. UnityEditor.DockArea:OnGUI()
  10.  


FizzPow

  • Jr. Member
  • **
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 83
    • View Profile
    • FizzPow Games
Re: Atlasmaker / Fontmaker problem
« Reply #5 on: June 25, 2014, 02:24:18 PM »
I figured out a fix for this.  My atlas textures were set to texture type of Sprite, and I changed to Advanced.  I no longer get the error.  Sprite worked fine in U4.3 though.

Nicki

  • Global Moderator
  • Hero Member
  • *****
  • Thank You
  • -Given: 33
  • -Receive: 141
  • Posts: 1,768
    • View Profile
Re: Atlasmaker / Fontmaker problem
« Reply #6 on: June 25, 2014, 04:36:14 PM »
Sprite is for uGUI when it comes out. I'd recommend you switch it to GUI and then advanced to get the correct settings, and then set it to Truecolor after.

FizzPow

  • Jr. Member
  • **
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 83
    • View Profile
    • FizzPow Games
Re: Atlasmaker / Fontmaker problem
« Reply #7 on: June 25, 2014, 04:39:15 PM »
Sprite is for uGUI when it comes out. I'd recommend you switch it to GUI and then advanced to get the correct settings, and then set it to Truecolor after.

Not entirely true.  Sprite is also for 2D stuff that's been in Unity for awhile now.  Either way, glad it was an easy fix once I figured it out.

focus

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 5
    • View Profile
Re: Atlasmaker / Fontmaker problem
« Reply #8 on: July 15, 2014, 11:49:12 AM »
This bug still reproduces on Unity 4.5.2 and NGUI 3.6.8.
I get "importer.GetNPOTScale() == TextureImporter::kNPOTKeep" etc. when I create new atlas from any imported textures (advanced import settings doesn't help) in absolutely empty project (it contains NGUI and 2 textures only).

It reproduces when I create new 2D project in Unity. And everything works fine if I create 3D project.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Atlasmaker / Fontmaker problem
« Reply #9 on: July 15, 2014, 10:02:44 PM »
When you create a new 2D project, all textures will be getting imported as sprites by default. That's what this post is talking about. They need to be type "Advanced", not "Sprite".

Nubeh

  • Newbie
  • *
  • Thank You
  • -Given: 1
  • -Receive: 0
  • Posts: 41
    • View Profile
Re: Atlasmaker / Fontmaker problem
« Reply #10 on: July 16, 2014, 02:49:51 AM »
Good to know this. I thought that textures to be packaged into atlas needed to be set as Texture. Does the bug appear also if the sprites are imported as Texture? Which settings do you recommend with the Advanced setting to create the atlas correctly (compression, mipmaps etc.)?

Nicki

  • Global Moderator
  • Hero Member
  • *****
  • Thank You
  • -Given: 33
  • -Receive: 141
  • Posts: 1,768
    • View Profile
Re: Atlasmaker / Fontmaker problem
« Reply #11 on: July 16, 2014, 08:44:22 AM »
Nubeh: Set it to GUI first, then Advanced, then the settings have been set to what they should.

No mip maps, automatic true color, NPOT: none.

Remember to set the size to be big enough that Unity doesn't resize your sprite to smaller than you intend it to be as well.

focus

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 5
    • View Profile
Re: Atlasmaker / Fontmaker problem
« Reply #12 on: July 22, 2014, 07:34:37 AM »
Switching textures to GUI then to Advanced doesn't work for me =(

Here is how I try to do it:
- Create new 2D project.
- Import NGUI
- Drag&Drop 2 textures to the Project view
- Select both textures
- Change type to GUI, press Apply
- Change type to Advanced, press Apply
- Open Atlas maker (two textures still selected) and press Create

As result, I get this error:
importer.GetNPOTScale() == TextureImporter::kNPOTKeep
...

Here is imported texture settings:
http://i.imgur.com/UoqSwGT.png

Even if it worked fine I'm afraid it's going to be a huge dip in workflow: I need to make sure everyone from team knows about textures tuning for atlas maker and we all should keep it in mind every time we import new textures in the project.
Would be great if NGUI tuned then itself before generating atlas if it's possible.
I'm not sure Unity guys going to fix this issue (it's already 4.5.2p1 and still no fix knowing bug was introduced in 4.5).

Nicki

  • Global Moderator
  • Hero Member
  • *****
  • Thank You
  • -Given: 33
  • -Receive: 141
  • Posts: 1,768
    • View Profile
Re: Atlasmaker / Fontmaker problem
« Reply #13 on: July 22, 2014, 02:38:10 PM »
You know, you can add this to the script of the UIAtlasMaker so that the settings get set from code to something you explicitly want. The reason this isn't done by default (it was at one point in the past) is that many people tend to want to tweak the details of importing themselves.

The actual bug you're seeing might be from the temp files not recognizing the import change (aka Unity bug :( )


ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Atlasmaker / Fontmaker problem
« Reply #14 on: July 22, 2014, 09:36:03 PM »
NGUI will force "truecolor" if you enable that checkbox in the Atlas Maker window. Same with 4096 textures. Yours seems to be limited to 1024... why? Change it to 4096 (or enable the checkbox in the atlas maker).

Changing it to 4096 won't make the texture 4096. it will simply allow it to get as big as 4096. You're basically saying, "if the texture exceeds 1024 in any dimension, shrink it to make it fit!", which will completely break your UIs.

You should always stick to default options if you're not sure what they do. Trim Alpha, Unity Packer, Truecolor, and 4096 options are all turned on by default.