Unity3D for iOS: “Exception: can’t find texture details for texture packer sprite:” with UIToolkit

I got this error the today when trying to update my Texture Atlas for a UIToolkit asset:

Exception: can't find texture details for texture packer sprite:panelTopFPO2x.png
UISpriteManager.textureInfoForFilename (System.String filename) (at Assets/Plugins/UIToolkit/BaseElements/UISpriteManager.cs:154)
UIVerticalPanel..ctor (.UIToolkit manager, System.String topFilename, System.String middleFilename, System.String bottomFilename) (at Assets/Plugins/UIToolkit/Containers/UIVerticalPanel.cs:60)
UIVerticalPanel.create (.UIToolkit manager, System.String topFilename, System.String middleFilename, System.String bottomFilename) (at Assets/Plugins/UIToolkit/Containers/UIVerticalPanel.cs:54)
UIVerticalPanel.create (System.String topFilename, System.String middleFilename, System.String bottomFilename) (at Assets/Plugins/UIToolkit/Containers/UIVerticalPanel.cs:48)
endGameScript+$animateIn$14+$.MoveNext () (at Assets/Scripts/MyPageScript.js:63)

I screwed up the source .png file names when adding files to Texture Packer, so “panelTopFPO2x.png” didn’t exist in the .txt (JSON) file. The actual file name was “panelTop2x.png”:

//Javascript:
var vPanel:UIVerticalPanel = UIVerticalPanel.create( "panelTopFPO2x.png", "panelMidFPO2x.png", "panelBotmFPO2x.png" );

//C#:
UIVerticalPanel vPanel = UIVerticalPanel.create( "panelTopFPO2x.png", "panelMidFPO2x.png", "panelBotmFPO2x.png" );

Adding the correctly named files in Texture Packer, republishing the texture atlas to my Unity project’s Resources folder and updating the code that calls these assets fixed the problem:

//Javascript: 
var vPanel:UIVerticalPanel = UIVerticalPanel.create( "panelTop2x.png", "panelMid2x.png", "panelBotm2x.png" );

//C#
UIVerticalPanel vPanel = UIVerticalPanel.create( "panelTop2x.png", "panelMid2x.png", "panelBotm2x.png" );
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s