Closed q393980062 closed 1 week ago
When I use Pack Texture to pack any file, I get the following error:
Texture must have width greater than 0. UnityEngine.Texture2D:.ctor (int,int,UnityEngine.TextureFormat,bool) Animancer.Editor.Tools.PackTexturesTool:Pack () (at ./Packages/com.kybernetik.animancer/Editor/Animancer Tools/PackTexturesTool.cs:184) Animancer.Editor.Tools.PackTexturesTool:DoBodyGUI () (at ./Packages/com.kybernetik.animancer/Editor/Animancer Tools/PackTexturesTool.cs:122) Animancer.Editor.Tools.AnimancerToolsWindow/Tool:DoGUI () (at ./Packages/com.kybernetik.animancer/Editor/Animancer Tools/Tool.cs:115) Animancer.Editor.Tools.AnimancerToolsWindow:OnGUI () (at ./Packages/com.kybernetik.animancer/Editor/Animancer Tools/AnimancerToolsWindow.cs:127) UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&)
It seems that in the current version of Unity, creating a 0x0 texture is not allowed.
var packedTexture = new Texture2D(0, 0, TextureFormat.ARGB32, false);
After changing the texture size to 1x1, the Pack Texture works correctly.
var packedTexture = new Texture2D(1, 1, TextureFormat.ARGB32, false);
I've confirmed the same in Unity 6. Your fix looks like the way to go so it will be in the next version of Animancer.
Animancer v8.0.2 is now available with this fix in it.
Environment
Description
When I use Pack Texture to pack any file, I get the following error:
It seems that in the current version of Unity, creating a 0x0 texture is not allowed.
var packedTexture = new Texture2D(0, 0, TextureFormat.ARGB32, false);
After changing the texture size to 1x1, the Pack Texture works correctly.
var packedTexture = new Texture2D(1, 1, TextureFormat.ARGB32, false);