Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.

Feedback Unity Editor Scripting Just Plain "Tedious"

Discussion in 'Editor & General Support' started by Jadefire16, Mar 22, 2021.

?

Which do you use?

  1. UI Elements

    1 vote(s)
    33.3%
  2. IMGUI

    2 vote(s)
    66.7%
  3. Both

    0 vote(s)
    0.0%
  4. other

    0 vote(s)
    0.0%
  1. Jadefire16

    Jadefire16

    Joined:
    Jul 14, 2019
    Posts:
    19
    Here I am to add my piece to the thousands of read and ignored messages about the Editor in Unity.

    I've been developing some tools for about 6 months now and in that time through all my hours of researching it's always led to hacky solutions to common problems which have been ignored for 5+ years or longer.
    Sometimes its worse and you simply realize there's a single undocumented function which will do exactly what you want after searching for 6 hours, usually found on the bottom of some stackoverflow post from 5 years ago.
    You see out of all of that time almost 75% of that has been writing, and rewriting, and rewriting andddd rewriting Editor code and trying to make it not only look "okay" at best, but functional.
    The state of the UI Elements docs is pretty atrocious at best, I've already submitted a report but it'll likely get thrown away like many other issues. So unfortunately after days of just trying to get something to work with it, I swapped to IMGUI which is tedious on the best of days.
    Here's what I personally think has been the most headache inducing:

    1. Lack of documentation. What isn't hidden is barely understandable when it comes to the Editor, especially when using Asset Database, what "path" refers to is always a nice gamble whether it be a full object path, a folder or what have you, I spent an entire month writing a library just so I didn't have to deal with the headaches it caused.

    2. Editor functions. The documentation isn't amazing with these, but as long as you aren't a beginner they're not super difficult to figure out, but stuff like calling OnInspectorGUI numerous times based on the event bothers me to no end, I'm sure there's some reason behind it, but I haven't been able to figure it out.

    3. Fetching data (outside of scene). Fetching data using Unity built in functions is confusing on the best of days, Resources.Load is great!.... if you use the Resources folder or if the assets you need are there, but sometimes its nice to be able to just query from the assets folder itself, and by god is that not fun. The FindAssets method still confuses me to no end, why It asks for "t: string: instead of just a type or what have you I'm not sure, but the method I found consisted of finding all GUID's, converting GUID's to asset path, and then from asset path loading the object. Tedious as usual.

    4. Lack of good in depth tutorials. The community is also at fault here (including myself) but every day it becomes more and more apparent to me why people in general avoid making tutorials on editor scripting. There's a few classes and functions Unity provides to help ease the process, but there's so much boiler plate code, even when using fancy (but usually slow) tricks like reflection. If my skills ever get up to a half decent level I may even begin to try and tackle some long ignored subjects and the solutions I found but until then, if we could get a somewhat up to date Unity learn video on how to use the Editor basics properly like windows or property drawers and such I'd personally be over the moon.

    5. Pre processor directives, while it may be bad practice to put your editor code merged in with your runtime code its convenient or at least it should be and or sometimes necessary but by god do they look awful, something about the fact that they refuse to stay indented or just break up the code in such a weird way really puts me off

    6. Statics, this ties in a bit with point 5 but I enjoy using static classes to provide helper classes and such for myself and other users. They're useful especially when building tools but often tedious to work with and not being able to view them in the inspector is a chore. This also goes without mentioning static members, It would be so useful even if the damn things were greyed out or I had to add an attribute to see them in the default inspector, having to shift to debug mode on your inspector is a pain and having two inspectors is fine when you don't have 6 other windows open. (having them on multiple windows is also just a bad time, they flicker or disappear etc. when flipping through tabs)

    7. IMGUI sucks. I likely won't be the first or last to say it but its really a handful to manage the EditorGUILayout and GUILayout functions, sometimes its even more effort than writing the whole layout out using GUI and EditorGUI. And why some of the params just have no effect or why when you tie certain things together all the sudden the element you thought you were applying that max width to is actually the wrong element and now you have to break it into two separate pieces to edit both of them the way you want? gross. But until UIElements actually gets decent documentation and I don't spend 2-3 hours trying to make a singular button which calls a function, I'll be stuck with IMGUI for the near future.​

    These 7 points are places where Unity just kicks the bucket for me personally, things like not being able to serialize dictionaries and such are a great pain too (I know get Odin, I've heard it a thousand times) and there's a bunch of other really frustrating things which Unity team members have said "I've informed x team and they're looking into it", but obviously fell on deaf ears as years later they still aren't fixed or changed. As it stands I don't want to have to shift to another engine, Unity is great for solo developers and small teams, but my god pay someone to fix this crap. I even offered if someone would teach me anything on UI elements to rewrite the damn docs and was promptly denied.
     
    ljarrettaha and Vryken like this.