-
Yes, you’re correct. Unless you wanted to change some things like the color, add graphics, change the default size… etc.
-
If you have any other UI modules, this could be bundled in the script with them. I have a UIModules.script with several different functions that make calculations, fit text to certain boundaries and insert line breaks, etc. So I put it along with them because it was related to UI. But this is absolutely fine–I just mentioned all that for organization’s sake.
-
Alright, you’d have to wire this differently then. What I mean is you’d have to detect which turret was pressed and use that to change each individual turret’s values. I touched a little bit on this inside the GameObject.script, which is listed below.
This just gets the file path. I haven’t tried using periods to file search, but it may be a substitute for “/”. The first slash tells it to start at Game.project, then continue to main file, then the GUI file, and then the on_button_message script. Put the script wherever you want, but make sure you change the file path to the correct one.
I tried doing as you asked, but I couldn’t figure out how to make a repository. I MacGyvered it although, and made it as close as I could.
https://gist.github.com/GamingBud
I posted the files, editing some things that I realized wouldn’t work for you. The main.collection file is an example showing how the collection should be laid out.
Another thing I realized is that I haven’t tested it for reproducing buttons. It will make them once, but then they cannot be recalled correctly. Sorry about this, I really should have spent more time and made sure it was finished before posting it as an example.