elringus / sprite-dicing

Cross-engine tool for lossless compression of sprites with identical areas
https://dicing.elringus.me
MIT License
1.35k stars 144 forks source link

Fix exception when building atlas on Unity 2022.2 #32

Closed sttz closed 1 year ago

sttz commented 1 year ago

The CreateSprite method, that is called using reflection, has added an additional argument in Unity 2022.2 and building a sprite atlas fails with an exception. This just sets the new secondaryTextures argument to its default null value.

(Looking at the new feature, this makes it possible to define multiple textures per sprite. I guess this could be used in SpriteDicing for single sprites to use dices from multiple atlases? I'm looking into using SpriteDicing in a project with big background textures and not having to pre-split textures could be useful.)

elringus commented 1 year ago

Thanks for the PR! Will merge it after figuring #30.

Regarding splitting textures: the plugin will automatically try to pack all the dices of a sprite into single atlas and throw exception when it's not possible, in which case you can try increasing max. atlas size. secondaryTextures could work as a fallback option in case dices from a sprite can't be packed into a single atlas, though it seems like a very rare use case to me.