Beispiel #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();
    }
Beispiel #2
0
    //
    #region AnimImgChangeVision
    private void Start()
    {
        functionSkin = new Skin("function");
        var templateskin = skeletonAnimation.Skeleton.Data.FindSkin(templateSkinName);

        if (templateskin != null)
        {
            functionSkin.AddAttachments(templateskin);
        }
        skeletonAnimation.Skeleton.Skin = functionSkin;
        RefreshSkeletionAttachments();
    }