// 查找并设置给Image(包括Sprite和材质) public void SetToImage(SDImage image, string name) { Sprite data = GetSpriteData(name); if (data != null) { SetImage(image, this, data); } else { image.sprite = null; image.material = null; } }
public static void SetImage(SDImage 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); } }