- Home /
 
 
               Question by 
               sebastiants2008 · Jun 16, 2019 at 11:35 AM · 
                augmented-realityaugmented realityrealityaugmentedrealityaugmented  
              
 
              how can i create a count down AR object that depends on a variable of remainnig stock?
hello all,
does anyone know how to create an AR object that change based on a variable of remaining stock? by instance, i have 10 apples in an inventory, and when i see the image target, the AR object appears "10", but when i consume one or more, the AR object change and display "9"
               Comment
              
 
               
               
               Best Answer 
              
 
              Answer by Ellie97 · Jun 16, 2019 at 02:58 PM
You'll need to link that value with the value in your inventory. Simple script example:
using UnityEngine.UI; public class InventoryText : MonoBehaviour { public Text arText; public int numberOfApples; private void Update() { arText.text = numberOfApples.ToString(); } }
Assign the arText variable in the inspector. You'll have to get your numberOfApples from your inventory as a reference or something
Your answer