- Home /
Implementing currency with gameObjects
Hello,
How can i implement in game currency in a script where i have an array?
This is the script in Unity Engine. So i have set the price to 100 let's say. But how can i access the array(price item - which is an int in my script)? and how can i reduce the currency with this value. For example coinAmount -= price
. Can you help me?
Thanks
capture.png
(56.7 kB)
Comment
Answer by Tourist · Nov 15, 2017 at 03:55 PM
You have to access the array data (the variable may be m_Data, m_data, Data or data) and access then the first element and the variable m_Price or m_price or Price or price in this element.
This script is not part of UnityEngine, as far as I know, and we will be able to help you more if you shared the source file.
Your answer
![](https://koobas.hobune.stream/wayback/20220612142846im_/https://answers.unity.com/themes/thub/images/avi.jpg)