TheZero

Hi all. I would like to ask about resource cost in Unity.
Is there any difference in importing two different animations. The first one has only animation of movements, in 2 skins for a certain stage. Or if everything is done in 1, then the result will be the same?
TheZero
  • Messaggi: 11

Misaki

Hi, I'm afraid I'm not sure what you mean by the question. Since you have asked a question about animation reference assets in the past, I assume that you are talking about adding animation at runtime to your skeleton, but in any case, it is difficult to answer without a more detailed description. Could you please describe to us what behavior you would like to see at your skeletons?
Avatar utente
Misaki

Misaki
  • Messaggi: 769

TheZero

Sorry, my knowledge of English is low, so I have to use transliteration.

What did I mean. I have 2 animations in my project, 1 contains 1 atlas, 2 contains 10 atlases with clothes.
The question itself is whether it makes sense to divide it all into 2 spines. Or will there be no difference in resource costs?
TheZero
  • Messaggi: 11

Harald

I'm not sure I understand your posting correctly, so please feel free to ask again in case I misunderstood your question.

If you are using skeleton 1 with a single atlas texture in e.g. level 1 and don't need additional skins, then this will be better in terms of memory consumption than loading 10 skins with 10 atlas textures which are not used. This is because Unity will load any textures that your scene assets references, and by default all textures of all skins are referenced by the SkeletonData asset. There are ways to remove the asset references from unused Textures or Materials and load them on-demand when you switch your skins, but this is a rather advanced topic.
Avatar utente
Harald

Harri
  • Messaggi: 4104

TheZero

Thanks, you got it right.
Based on your answer, if you don't mind, I'll ask 1 more question on the topic.
Let's say we have some kind of animation controller that contains 2 Skeleton Data in 1 - 1 atlas in 2 - 10 atlases. Based on the current stage, it chooses which one to use. Will resources be loaded when using Skeleton Data, or will 2 Skeleton Data be loaded at once?
TheZero
  • Messaggi: 11

Harald

Here it depends on how you hold references to your SkeletonData assets. Regarding loading textures, normal Unity rules apply - if objects in your scene reference an asset (also indirectly, via references to assets that reference other assets), it will be loaded. You can find a brief summary on a forum thread here.

Regarding loading the animation and attachment data of a SkeletonData asset, this data will be loaded when any skeleton component is initializing with this SkeletonData asset for the first time (so e.g. when enabling a SkeletonAnimation GameObject in an active scene). The already loaded shared animation and attachment data of a SkeletonData asset is re-used when other skeletons also use the same SkeletonData.
Avatar utente
Harald

Harri
  • Messaggi: 4104


Torna a Unity