Fight That OCD (CUSTOM INSPECTOR Unity)

Поделиться
HTML-код
  • Опубликовано: 21 окт 2024

Комментарии • 58

  • @SpeedTutor
    @SpeedTutor  2 года назад +2

    Let me know if you have any tips or tricks for customizing your inspector! I think it's a great way to save yourself time and MAKE THINGS LOOKS BEAUTIFUL!
    🕹Unity's Asset Refresh Sale: bit.ly/UnitySalesHub
    🕹BRAND NEW Quick-Start Bundle: bit.ly/UnityQuickStartBundle
    🕹My Unity Store Assets: bit.ly/STUnityStorePuzzlePacks

  • @caden5936
    @caden5936 Год назад +14

    Great tutorial! But dang Unity needs to make this way easier imo, I hope one day they make it a simple property attribute

    • @SpeedTutor
      @SpeedTutor  Год назад +2

      Haha, I think this is why they've tried to add UI Toolkit but I had a look in to it a couple of months back and honestly looked more confusing. Haha.

  • @TheGrimmy
    @TheGrimmy Год назад +4

    Ahh! This is the one you were talking aboot. Love it!

    • @SpeedTutor
      @SpeedTutor  Год назад +1

      Haha, it's a lot to take in and is quite faffy but once you've got some custom inspectors going. It really neatens things up :)

    • @TheGrimmy
      @TheGrimmy Год назад

      @@SpeedTutor Oh yeah, it looks SOOO much better. I had a GameData savefile essentially that I already sorted from where each data gets used and such, and now it's all neatly stacked and closed off. It's SO darn good now. Like tabs in a filing cabinet, haha. Thank you so much for this :D

  • @IceForgeOfficial
    @IceForgeOfficial 6 дней назад +1

    Love the tutorial! Quick and concise but explains enough to understand!

    • @SpeedTutor
      @SpeedTutor  6 дней назад

      Glad you found it useful, what are you creating?

    • @IceForgeOfficial
      @IceForgeOfficial 5 дней назад

      @@SpeedTutor Well, I’m not really that good of a developer but I’m trying to develop a new game. I love this tutorial by the way, I know I said it already, but thanks for creating this video it is super useful for the game dev community :)

  • @IceForgeOfficial
    @IceForgeOfficial 6 дней назад +1

    You were putting “SerializeProperty” on each variable separately. You can also use the shortcut of holding down Shift+Alt then select all lines you want to edit.

    • @SpeedTutor
      @SpeedTutor  6 дней назад +1

      Thanks for the tip, my friend! :)

  • @Sam4Progress
    @Sam4Progress 8 месяцев назад +2

    It took me a minute to figure out how to apply this to my script, but once I did, this tutorial was exactly what I had spent the past 6 hours looking for!
    For those that werent immediately clear:
    If you want to stack a bunch of stuff in the Check Box, just delete the outer layer of code he wrote! Works like a-charm if that's your preference!

    • @SpeedTutor
      @SpeedTutor  8 месяцев назад +1

      Thanks for sharing, my friend! :) I really appreciate it and I hope it will help others out too.

  • @MatthewPatterson-nr2gh
    @MatthewPatterson-nr2gh Год назад +2

    I will add, just because it wasn't explicitly said: In order for the editor script to work, each property in the original component script needs be prefaced with ` [SerializeField] `. It was shown in the intro but wasn't verbally emphasized.
    Otherwise, love this video, thank you so much. I've always wanted to beable to make user friendly inspectors and scene/object setups.
    I understand the appeal of Odin, it IS really nice. However, I really appreciate knowing how to do this by hand because if I want to create a package the sell on the asset store, I wouldn't want to force the user to buy another package before being able to use mine.

    • @SpeedTutor
      @SpeedTutor  Год назад

      You're exactly right, my friend. I wanted to use Odin myself but there is no way to have the custom inspector saved without the need for Odin installed. I learned this in exactly the same way as you. I love using "EditorGUILayout.LabelField" - It can create really nice headings with a dark backing, I don't think I showed it in this video. Good luck with all your stuff! :)))
      Also if you wanted to create a button in the inspector which lets you open the custom editor script for the current script which uses it you can use something like this:
      void OpenEditorScript()
      {
      if (GUILayout.Button("Open Editor Script"))
      {
      string scriptFilePath = AssetDatabase.GetAssetPath(MonoScript.FromScriptableObject(this));
      AssetDatabase.OpenAsset(AssetDatabase.LoadAssetAtPath(scriptFilePath));
      }
      }
      I hope these help! :D

  • @deadbroadcastpc
    @deadbroadcastpc 2 года назад +3

    Mannnn your projects are probably so clean and organized, some really useful info yet again, thanks brother!

    • @SpeedTutor
      @SpeedTutor  2 года назад +2

      Haha, is it spaghetti junction up in there? :P

    • @deadbroadcastpc
      @deadbroadcastpc 2 года назад +1

      @@SpeedTutor no way, it’s hard enough to find things with clean code....spaghetti has been off the menu awhile now lol

    • @SpeedTutor
      @SpeedTutor  2 года назад

      Spaghetti is over-rated anyway!

  • @syluxdev
    @syluxdev 2 года назад +4

    Odin inspector is the best tool to make editors easily

    • @SpeedTutor
      @SpeedTutor  2 года назад +2

      I've got the asset but I've never used it myself, is it really good? Needless to say, I make a few different assets and I obviously can't bundle odin with it to make the inspector. So I wanted to show how I've done it a few times. Thanks for commenting! :)

  • @gojarz7127
    @gojarz7127 Год назад +1

    Thanks, it's so useful and also easy to understand!

    • @SpeedTutor
      @SpeedTutor  Год назад

      I'm glad you've found it useful, thanks for watching my friend! :)

  • @wtflolomg
    @wtflolomg 2 года назад +4

    Odin for the win... along with ScriptableObjects, these two things have revolutionized my development workflow.

    • @SpeedTutor
      @SpeedTutor  2 года назад +1

      I'd agree on the SO part! As for Odin, I need to try this out myself. I've got it but never used it. How good is it /10?

    • @TopShelfCookieJar
      @TopShelfCookieJar 2 года назад +1

      @@SpeedTutor It's reeeeally good ie 10/10. Makes doing what you've done here super easy, just by scattering a few attributes in your existing scripts. It's the first thing I install in every project.
      That said, it's only useful if everyone using your code has Odin eg in your project team or people who download your assets, so it's not a one size fits all solution. In an ideal world Unity would buy them out and we'd live happily ever after...

    • @wtflolomg
      @wtflolomg 2 года назад +2

      @@SpeedTutor I would say @ledshok sums it up nicely. Odin just makes it extremely easy to make new editor windows and things like action buttons.

    • @SpeedTutor
      @SpeedTutor  2 года назад +5

      I think you're both right. Rather than Unity making ridiculous acquisitions and laying off lots of staff recently, if they could have bought some genuinely useful like Odin. It would be amazing because I'd love to have more decent attributes added. Thanks for the information ledshok! As I say, I can't use it unless others have access to it and it doesn't really make sense for me to use on a daily basis otherwise. Although I'm definitely going to look into it, then I can cry at how easy it is! :P

  • @courtneyleinonen7767
    @courtneyleinonen7767 Год назад +3

    Instead of setting some variables to public and other to private, I would suggestion using properties instead. Something like: '[field : SerializeField] public bool exampleBool { get; private set; }'
    This way, there's no chance of accidentally setting a variable somewhere you didn't mean to.

  • @aeroniix1489
    @aeroniix1489 2 месяца назад +2

    Underrated.

    • @SpeedTutor
      @SpeedTutor  2 месяца назад

      I hope you found it useful! :D Are you creating something cool?

  • @Patricebrouh
    @Patricebrouh 7 месяцев назад +1

    Thank you so much. It's so helpful

    • @SpeedTutor
      @SpeedTutor  7 месяцев назад

      You're very welcome! :D What are you looking to make?

  • @gmangman123
    @gmangman123 2 года назад +1

    good video again! Thx my friend.

  • @MuhammadBilal-cs3dg
    @MuhammadBilal-cs3dg 8 месяцев назад +1

    Really helpul

    • @SpeedTutor
      @SpeedTutor  8 месяцев назад

      I'm glad you found it helpful! :D

  • @glitchover9894
    @glitchover9894 8 месяцев назад

    Super

  • @aurealis2041
    @aurealis2041 Год назад +1

    thank you

    • @SpeedTutor
      @SpeedTutor  Год назад

      You're very welcome, thanks for checking this out! :D

  • @syzg
    @syzg 2 года назад +4

    Can you enable the closed caption, please? I am Deaf.

    • @SpeedTutor
      @SpeedTutor  2 года назад +2

      They're enabled by default, as long as you click the little button on the RUclips player. I can enable them myself. I hope you get to watch it, thanks for checking this out! :)

    • @syzg
      @syzg 2 года назад +3

      @@SpeedTutor it was greyed out but now it is on, thank you!

    • @SpeedTutor
      @SpeedTutor  2 года назад +2

      I guess it just takes time to appear! Thanks for sticking with it, my friend! :)

  • @hassanshahzad7357
    @hassanshahzad7357 Год назад

    hmm soo the data we mentioned in inpector will be save rgiht ? and If we put on every object data will be accordingly...

    • @SpeedTutor
      @SpeedTutor  Год назад

      The inspector saves as it normally does, apart from if you've hidden some fields then you may need to use EditorPrefs to save whether you've dropped down or not.

  • @さしあたりのない名前
    @さしあたりのない名前 7 месяцев назад +1

    nice!

    • @SpeedTutor
      @SpeedTutor  7 месяцев назад

      Thanks very much! :)

  • @ray1997
    @ray1997 2 года назад +1

    I'm not sure if nameof() feature work, but OnEnable() when finding property you can use
    playerType = serializedObject.FindProperty(nameof(playerType));
    The code seems longer and felt redundant, but it's better for when the time you want to rename property, it would show up error which is not the case for FindProperty("playerType")

    • @SpeedTutor
      @SpeedTutor  2 года назад +1

      That's a pretty awesome suggestion! Thanks for that. You do get some very unhelpful error messages if a field or property is removed and not accessible anymore.

    • @ray1997
      @ray1997 2 года назад +1

      oh and btw..
      Pressing CTRL+R twice on property will rename it and all its reference on Visual Studio, as you know..
      That property inside nameof() will get rename too, so you don't have to comeback and update it 😳

    • @SpeedTutor
      @SpeedTutor  2 года назад +1

      The more you know! Thanks, my dude. Really awesome pointer, right there!

  • @devarshpatel73
    @devarshpatel73 Год назад

    Hello I really liked the video and the information given is great but I'm getting an namespace error whenever I try to build the apk, I hope that someone can provide me with its solution if anybody else also facing this kind of issues.

  • @Ozzy89CZ
    @Ozzy89CZ 2 месяца назад

    Useless because it works UnityEditor only...

    • @SpeedTutor
      @SpeedTutor  2 месяца назад +1

      I'm not sure where else you expected a custom Unity editor inspector to work?

  • @hbcck
    @hbcck 2 года назад +1

    Firstly, thank you for video, I really liked.
    How can I show a list?
    [SerializeField] public List Tiles = new();
    EditorGUILayout.ObjectField(Tiles); is not working