Warped

How to change SpineAtlasAsset?
The main goal is changing character skins at runtime. Character has a huge amount of skins props etc. If i'll call simple skin combining like in tutorial i'll still have extra materials and loss memory. I want to have textures separately of my skin and apply or load only needed.

II tryed AtlasRegionAttacher as in example. But there is no animation deformations and coordinates messed.

The best way is CustomMaterialOverride. Its working really faster than MixAndMatch and allows changing textures.
skeletonAnimation.CustomMaterialOverride[param.referenceMaterial] = param.newMaterial;
But you shoud have fixed positions of images in atlas after exporting. Animator said its ipmossible! Spine each time make random positions.

Last chance is changing SpineAtlasAsset. It allows to hold image positions in metadata.
I found method allows change on source skeleton
skeletonAnimation.skeletonDataAsset.atlasAssets[i] = atlasAsset;
How to change it on instance?

Thanks
Warped
  • Postovi: 3

Harald

Warped je napisao/la: I want to have textures separately of my skin and apply or load only needed.
Then we suggest that you load the textures only when needed, by e.g.using Adressables, Asset Bundles or any other means of delayed loading. Just clear the undesired direct Texture references in your Material assets and load them via a simple logic when you actually need them. See this forum posting for more info, including with some additional references:
Too many material due to dynamic reload
Warped je napisao/la:But you shoud have fixed positions of images in atlas after exporting. Animator said its ipmossible! Spine each time make random positions.
It's neither impossible nor random. You just need to tell you animator to export with the proper texture export settings, then it will export in the exact same layout. For example when having Strip whitespace X/Y enabled and having different amount of whitespace in each skin, then it will obviously pack differently. See this thread for more info:
How to match an existing atlas?
Warped je napisao/la:Last chance is changing SpineAtlasAsset. It allows to hold image positions in metadata.
I found method allows change on source skeleton
How to change it on instance?
If you really still want to do that, you need to create a separate copy of the SkeletonDataAsset with your custom atlas asset assigned, see SkeletonDataAsset.cs#L85.
Then you need to call skeletonAnimation.Initialize(true) as always after changing the SkeletonDataAsset.
Avatar
Harald

Harri
  • Postovi: 4451


Natrag na Runtimes