private static ReadableTexture2D GetTexture(Material material) { if (material.HasProperty("_MainTex") && material.mainTexture != null) { return(TextureUtils.CreateReadableTexture2D(material.mainTexture as Texture2D)); } return(TextureUtils.CreateTextureFromColor(material.color)); }