Implementing currency with gameObjects


How can i implement in game currency in a script where i have an array?105581-capture.png

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?


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.