/// <summary>
        /// Changes the sprite mesh.
        /// </summary>
        /// <param name="sm">Will replace SpriteMesh</param>
        /// <param name="texture">new Texture.</param>
        /// <param name="mat">Mat.</param>
        public void ChangeSpriteMesh(SpriteMesh sm, Texture texture, Material mat = null)
        {
            if (!sm || !texture)
            {
                return;
            }

            if (mat)
            {
                sm.atlasMat = mat;
            }

            sm.atlasMat.mainTexture = texture;
            sm.frame.material       = sm.atlasMat;
            sm.frame.texture        = texture;
            sm.frame.isRotated      = false;

            sm.frame.rect.x             = 0;
            sm.frame.rect.y             = 0;
            sm.frame.rect.width         = texture.width;
            sm.frame.rect.height        = texture.height;
            sm.frame.frameSize          = new Rect(0, 0, texture.width, texture.height);
            sm.frame.atlasTextureSize.x = texture.width;
            sm.frame.atlasTextureSize.y = texture.height;

            sm.UpdateUV();
        }
        /// <summary>
        /// Changes the sprite mesh.
        /// </summary>
        /// <param name="spriteMeshName">Sprite mesh name.</param>
        /// <param name="newTextureFrameName">New texture frame name.</param>
        public void ChangeSpriteMesh(string spriteMeshName, string newTextureFrameName)
        {
            Renderer attachment = GetAttachmentByName(spriteMeshName);

            if (!attachment)
            {
                return;
            }

            SpriteMesh   sm    = attachment.GetComponent <SpriteMesh>();
            TextureFrame frame = GetTextureFrameByName(newTextureFrameName);

            if (sm != null && frame != null)
            {
                sm.atlasMat = frame.material;
                attachment.sharedMaterial = frame.material;
                sm.frame = frame;
                sm.UpdateUV();
            }
        }