Hi. Very new to Unity. I’ve spent the last couple of days researching and getting nowhere with this. Hopefully someone here can help. I haven’t posted the code as the contents of the code are not important. I need help with referencing.
I am trying to make one of those incremental money games, but with a bit of a twist. The first section will be like having 3 games at the same time. In the code, I obviously have to reference the cost (text), amount (text), rate of income (text) and the button (button) for each minigame (for lack of a better term).
They all work identically. There are just 3 of them. However, when I assign the script to set 1, I assign (by drag and drop) the price, amount and rate, but it updates for all 3 instances of the script meaning set 1’s price text box is being used for all 3 minigames price. Which I do not want.
I am able to make the button work by assigning the script to the button and then using GetComponent(). However, I do not know the code required to do this for text boxes with the same parent or if I need to be assigning the script to the parent instead of the button or what I need to do.
I did have a way of making this all work by using a lot of code and it looked very messy, so worst comes to the worst, I have a way of fixing it. I just wanted to make the code a lot shorter, neater and simpler.