Hello all,
There is probably a better forum place to ask this question but i don’t know where that would be.
As the title states I am wondering why the unity Developers saw it as a whise move to remove the old OnGui system and replace it for their as they call it: “You should use Unity’s up-to-date UI system instead”
I get that they like to change things and improve their engine and I get that they want to make it more accessible to make an UI. The idea is that you should be able to manage everything from inside the editor and don’t need to use code to create an UI, and since artists are the once mostly focused on creating the UI this way they should be able to make it from the editor right?
This is true basically anyone can start making an ui right now instead of needing to be able to code to make an ui. But its restricting to use the editor ui.
And trying to make the buttons from the new ui fully by code is an absolute nightmare.
void OnGUI()
{
if (GUI.Button(new Rect(10, 10, 150, 100), "I am a button"))
{
print("You clicked the button!");
}
}
HOW SIMPLE CAN IT BE?
ofcourse this is the easiest version of a button but still just try and do the same with creating a button with the new ui, here are a few things you have to do:
create 2 gameobjects (one for the button and one for the text)
add a recttransform for both
define anchor points for the recttransform
set the size (and no not using the normal transform.position and transform.size etc. but the recttransform versions which are just weird after being used to using gameobject.transform
set the parent canvas
add component image
add component button
and many many more things just to create a normal button, seriously why unity developers?
OnGui was so easy to use so simple so why did you have to force the new UI system on us?
Why did you have to remove the OnGui system? why not just leave it running next to the UI system?
edit(moved from answer)
You might be wondering what prompted this question…
I have been working with both system on many different projects, but right now because of hardware i need to use 2019 so OnGui is no more in this version.
In the project that I’m working on everything needs to be scaled correctly with the screen on both axis does this work properly right now with the UI system? NO.
Would this have been an easy fix using OnGui? YES.
What does this mean for my project? I need to make every UI part with code to be able to change sizes fonts and everything else by code!
So a system focused on working solely from the editor is terrible to mimic using code, its just plain awful compared to writing the same with OnGui. I have been spending a long time first setting it all up in the Hierarchy first of all its way to much to wanting to have it all in hierarchy but sure its meant to be build in the Editor so I comply. I finish it turns out I cant make it work with what I need
- It takes up way to much resources to have it all in the Hierarchy
- It is a nightmare to change the ui elements from code while its in the Hierachy
So right now I’m recreating the Whole ui by code and im looking at this hot mess and just wheep thinking how much more streamlined and optimized OnGui would have looked in comparison!