flash · 6385
Excellent. I'm really impressed over how much and how many modes you've fitted into this. If I'd done it the code would be unmanageably bloated and horrible. I hope you're doing better.
if (System.IO.File.Exists(m_docPath + filename)) { byte[] bytes = File.ReadAllBytes(m_docPath + filename); Texture2D texture = new Texture2D(1, 1,TextureFormat.RGB24, true); yield return 0; texture.LoadImage(bytes); texture.filterMode = FilterMode.Trilinear; texture.Apply(); yield return 0; m_levelSnapshot.enabled = true; m_levelSnapshot.sprite = Sprite.Create(texture, new Rect(0,0,texture.width, texture.height), new Vector2(0.5f,0.0f), 1.0f); // img.sprite.texture.filterMode = FilterMode.Trilinear; yield return 0; }
public static Texture2D LoadPNG(string filePath){ if (!File.Exists(filePath)) return null; byte[] fileData = File.ReadAllBytes(filePath); Texture2D texture = new Texture2D (2, 2, TextureFormat.BGRA32, false); texture.LoadImage(fileData); return texture;}