L
L
Loshka242021-12-23 11:19:48
Unity
Loshka24, 2021-12-23 11:19:48

How to provide clicking on several different buttons in one script?

I make a strategy using hexes, each hex is a separate game object, to simplify the work, hexes are divided by their type, for example, hex forests, fields, etc., respectively, the script for hexes of the same type is one. When you click on a hex, a Panel should come out (Also one), which displays information about the hex, how many resources it produces, the level and type of terrain, stuck at the moment that it is necessary to carry out all calculations and work with the panel from the script of the hex itself, that is values ​​are assigned when you click on the hex itself, because if you do it differently, referring to variables from the hex script, in a script that hangs on the panel, then in theory there will be an error, since the hex script is 1, and the versions of the variables in each script are different. The question is how to provide for pressing several buttons, i.e. void OnMouseUpAsButton - opens the panel, and then in the same script, a click is provided, but already on another button? Thanks in advance
PS I know what can be done through the OnClick method, then the question is completely gone, how to remove text from ButtonXD

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question