I want my code to grab an icon from a folder, convert it to a texture and render it as a rawImage but I can’t figure it out
here is my code:
MemoryStream ms = new MemoryStream();
Bitmap bitmap = System.Drawing.Icon.ExtractAssociatedIcon(f.FullName).ToBitmap() ;
bitmap.Save(ms, bitmap.RawFormat);
Texture2D txt = new Texture2D(2, 2);
txt.LoadImage(ms.ToArray());
obj.transform.GetChild(0).GetChild(0).gameObject.GetComponent<RawImage>().texture = txt;
// /\ this line finds rawImage that i want to use
where f.FullName is path to the file
unity doesn’t show any errors but wher i start debuging the only thing i see is this: