Example #1
0
 public void UpdateItemTexture(int itemID)
 {
     try
     {
         if (System.IO.File.OpenRead(Application.streamingAssetsPath + "/ItemIcons/" + itemID + ".dds") != null)
         {
             //Debug.Log("Image found!");
             var itemTexture = System.IO.File.ReadAllBytes(Application.streamingAssetsPath + "/ItemIcons/" + itemID + ".dds");
             finalResult = TextureTool.LoadTextureDXT(itemTexture, TextureFormat.DXT5);
             var transform = targetImageObj.transform.localScale;
             targetImageObj.transform.localScale = new Vector3(transform.x, transform.y * -1, transform.z);
             targetImageObj.GetComponent <RawImage>().texture = finalResult;
         }
     }
     catch (Exception e)
     {
         Debug.LogError("Error: No image found for object " + itemID + ", defaulting to ? icon."); //TODO: swap out LU DDS for something else, in case LEGO doesn't like us using it
     }
 }