You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I would like to have a script, similar to the ButtonConfigHelper, where I can choose the GameObjects for the OnClick()-list by selecting them from a list (e.g. by a list of Tags).
The reason is that I cannot drag a GameObject from another Scene into a prefab with the ButtonConfigHelper, but I could use predefined tags. So for example I defined a list of GO-classes and their associated tags in the script. I choose a tag in the list in the inspector and the associated components and methods are shown which I can select (like in the ButtonConfigHelper). When the game is running and OnClick() Event is fired the script just chooses the (e.g.) first GO it can find with the tag (FindGameObjectsWithTag()) and runs the selected method.
Otherwise I have to implement a single script for every GameObject, just to look up a GO by its tag and run a method. That creates so many small scripts.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I would like to have a script, similar to the
ButtonConfigHelper
, where I can choose the GameObjects for theOnClick()-list
by selecting them from a list (e.g. by a list of Tags).The reason is that I cannot drag a GameObject from another Scene into a prefab with the ButtonConfigHelper, but I could use predefined tags. So for example I defined a list of GO-classes and their associated tags in the script. I choose a tag in the list in the inspector and the associated components and methods are shown which I can select (like in the ButtonConfigHelper). When the game is running and OnClick() Event is fired the script just chooses the (e.g.) first GO it can find with the tag (
FindGameObjectsWithTag()
) and runs the selected method.Otherwise I have to implement a single script for every GameObject, just to look up a GO by its tag and run a method. That creates so many small scripts.
Beta Was this translation helpful? Give feedback.
All reactions