//Update is called once per frame
    void Update()
    {
        if (jsonIsDone)
        {
            //convert json string to class
            try
            {
                productObject = ProductDataClass.FromJson(productJson.ToString());
            }
            catch (NullReferenceException ex)
            {
                Debug.Log("Error Converting " + ex.ToString());
            }


            if (productObject != null)
            {
                try
                {
                    ProductManager.SetCurrentProduct(productObject);
                    Debug.Log("Product Object created: " + ProductManager.GetCurrentProduct().Product.ProductName + " " + ProductManager.GetCurrentProduct().Product.Brands);

                    StartCoroutine(CreateImageFromDownloadedTexture());

                    //Update Swipe Up UI Text
                    //Buggy on android UI not updating
                    productName.SetText(ProductManager.GetCurrentProduct().Product.ProductName);
                    GameObject.Find("ProductCompanyText").GetComponent <TextMeshProUGUI>().SetText(ProductManager.GetCurrentProduct().Product.Brands);
                }
                catch (NullReferenceException ex)
                {
                    Debug.Log("NullRefrenceExeption " + ex.ToString());
                }
            }
            else
            {
                Debug.Log("ERROR NULL OBJECT");
            }

            jsonIsDone = false;
        }
    }
Пример #2
0
 /// <summary>
 /// Set the new current product
 /// </summary>
 /// <param name="newProduct">The new product</param>
 public static void SetCurrentProduct(ProductDataClass newProduct)
 {
     product = newProduct;
 }