Esempio n. 1
0
    public void OptimizeSkin()
    {
        // 1. Collect all the attachments of all active skins.
        collectedSkin = collectedSkin ?? new Skin("Collected skin");
        collectedSkin.Clear();
        collectedSkin.AddAttachments(skeletonAnimation.Skeleton.Data.DefaultSkin);
        collectedSkin.AddAttachments(functionSkin);

        // 2. Create a repacked skin.
        var repackedSkin = collectedSkin.GetRepackedSkin("Repacked skin", skeletonAnimation.SkeletonDataAsset.atlasAssets[0].PrimaryMaterial, out runtimeMaterial, out runtimeAtlas);

        collectedSkin.Clear();

        // 3. Use the repacked skin.
        skeletonAnimation.Skeleton.Skin = repackedSkin;
        RefreshSkeletionAttachments();
    }
        public void OptimizeSkin()
        {
            // 1. Collect all the attachments of all active skins.
            collectedSkin = collectedSkin ?? new Skin("Collected skin");
            collectedSkin.Clear();
            collectedSkin.Append(skeletonAnimation.Skeleton.Data.DefaultSkin);
            collectedSkin.Append(equipsSkin);

            // 2. Create a repacked skin.
            var repackedSkin = collectedSkin.GetRepackedSkin("Repacked skin", skeletonAnimation.SkeletonDataAsset.atlasAssets[0].materials[0], out runtimeMaterial, out runtimeAtlas);

            collectedSkin.Clear();

            // 3. Use the repacked skin.
            skeletonAnimation.Skeleton.Skin = repackedSkin;
            RefreshSkeletonAttachments();

            skeletonAnimation.OverrideTexture = runtimeAtlas;
        }