public static void SetImage(ImageEx image, AtlasData ad, Sprite sprite) { image.sprite = sprite; //image.SpriteName = sprite.name; if (ad.material != null || !(image.material != null && string.Equals(image.material.shader.name, "UI/Default(grey)"))) { image.material = ad.material; } else { image.material = null; } AtlasReference reference = image.GetAtlasReference(); if (reference != null) { reference.AddRef(image, ad); } }