Hey, I got some feedback on some posts about how I created interactive buttons for my game using scripts, apparently they create more lag, though wouldn’t it be a pain with making sure each button was positioned on each screen properly otherwise?
Uiaspectratioconstraints and scale size/pos ?
I found that It’s usually unreliable, plus how much of a difference will I see if I am not creating UI’s through scripts?
I prefer making all GUI objects ahead of time, and using UI constraints to ensure correct positioning. I only script event handling.
No reason whatsoever. Personal preference, except a little loading bump at the beginning if that is when you’re creating them, if you’re down to figure out the correct sizes, curves, colors, positions, texts in code, you’re free to do so without bad practices. Still this is utterly useless and pointless, just pre-make it and clone it if you wanna code it that bad.
Adding on, the lag people have told you about is just the beginning when the instances are being parented, this method does not decrease performance permanetly in any way.
Cause I can make the same UI by clicking a few buttons in 1/10th of the time it takes to write out that code. Plus, it’s a lot easier style and modify than with code generated UI.
Actually, creating UI with a script should be faster and possibly more secure.
Because you already have a reference to every object in the GUI, there is no need to index them again to do stuff with them. Which why I say it’s faster
Additionally, because you don’t have to index them again, you can set their name to an empty string preventing exploiters from indexing them with the dot operator unless they execute a script beforehand that prevents you from changing it.
You should set the parent property last, it’ll save on rendering. However you could avoid all that if you just create the UI without a script.
I think it’s a bad idea to create UI through scripts because it might be easier on workflow to be able to instantly visualize your UI instead of having to playtest every time you add/modify something.