Пример #1
0
        public void Cut(string textureKey, Texture2D texture)
        {
            this.texture = texture;
            if (useRuntimeSize)
            {
                size = GetComponent <RectTransform>().rect.size;
            }
            //Debug.Log("Cut " + size + " for " + gameObject.name);
            if (size.x == 0 || size.y == 0)
            {
                Debug.LogWarning("Cutter exit, size 0");
                return;
            }

            cutJob?.Abort();
            cutJob = Net.WebCache.instance.CutTexture(textureKey, texture, size, borderRadius, job => {
                cuttedTexture = job.GetData();
                image.texture = cuttedTexture;
                image.color   = Color.white;
                cutJob        = null;
            });
        }
Пример #2
0
 private void OnDisable()
 {
     cutJob?.Abort();
     cutJob = null;
 }