Easy Editor Windows in Unity with Serialized Properties

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

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

  • @gonzaloescamilla8488
    @gonzaloescamilla8488 4 года назад +136

    Please, it would be awesome if you could create more detailed videos on how to create custom editor in Unity.

    • @vincentp9673
      @vincentp9673 4 года назад +7

      i would really like a tutorial playlist on a more or less "full" game of GameDevGuide

    • @TiimedArts
      @TiimedArts 4 года назад +3

      The information from the video is enough to program your own custom editor. You just need your own ideas lmao

    • @dragonboyx123
      @dragonboyx123 4 года назад +16

      @@TiimedArts To be honest, I found this a bit confusing. Some of the things I wanted to learn from the video, he skipped them. I have ideas, but I need someone to teach me about how to operate the Editor.

    • @shadmansudipto7287
      @shadmansudipto7287 4 года назад +5

      @@dragonboyx123 that's how this channel is man, he's got even worse videos where he doesn't show the code at all for shaders and doesn't share the project files either.

    • @kaleb_t4818
      @kaleb_t4818 3 года назад

      @@dragonboyx123 did you find any thing useful ?

  • @Dizastrophe
    @Dizastrophe 4 года назад +33

    Would love a more in depth video showing all the different kinds of things you can do!

  • @geoffreyhendrikx
    @geoffreyhendrikx 5 лет назад +27

    I just found this channel and i love it already.
    You explaining everything very well.

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

    watched this video 3 years ago. Had no idea how to do any of this. Now i'm making my own tools. Thank you for inspiring me 😭😭

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

    i love your videos, you pack so much into 10 minutes but at the end of it you know the process and personally i do revisit your videos allot and slowly work my way through them but that first time watch is like a strong hit of coffee and taste so dam good.

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

    i like how you show the problem you encounter first, then present a solution, very well-made video!

  • @jack4law
    @jack4law 5 лет назад +4

    Awesome video as ever! I love the explanation before the main tutorial started... Improved my understanding of what I was going to learn. Good job!

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

    Did no one else see that comment at 1:24? "Change these fuckers". A game dev in my liking.

  • @paulthompson52
    @paulthompson52 3 года назад

    Would like to see more videos from you on this subject...really awesome work!!

  • @BeeGameDev
    @BeeGameDev 4 года назад

    This is excellent and just what I needed. Also, I feel like you managed to condense some of the 40+min impenetrable tutorials down into just 10 minutes. Time saver! Cheers!

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

    I just found you, amazing tutorials. Subscribed!

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

    I always find you when i most needed, you're best

  • @322ss
    @322ss 5 лет назад

    Thank you! Probably couldn't have been able to come up with such a neat solution without this video... insightful stuff. I've only managed to find few articles about using SerializedObjects...

  • @MichaelFurmedge
    @MichaelFurmedge 4 года назад +1

    High quality video dude, I really appreciate the time you're taking to make these.

  • @raycodes7393
    @raycodes7393 3 года назад

    I've been looking for this for a week now ARRRGH
    Thank you!

  • @rofosaurus3758
    @rofosaurus3758 4 года назад +1

    You just blew my mind mate.

  • @anaibrahim4361
    @anaibrahim4361 4 года назад

    Didn't find what to see
    Exactely what i was looking for thanks soo much
    You gave it in fantastic presentation

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

    would you cover how to build those node editors? That looks that it'd be immensely useful!
    Thanks for the videos!

  • @euriherasme
    @euriherasme 3 года назад

    Thank you so so so so much, this and every single one of your tutorials are really awesome, I cannot thank you enough!

  • @HadiLePanda
    @HadiLePanda 4 года назад +1

    Really useful for organizing, thanks for the tutorial!

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

    You just destroyed all my doubts, thanks 🤘

  • @TheWalruzz
    @TheWalruzz 4 года назад +1

    While I usually hate video tutorials (I prefer to visually scan text tutorials to save me time) your videos are truly amazing and straight to the point. And even though I rolled out my own solutions to some of the problems you give tips for, I always find something new to learn and improve upon in my project after watching your guides. 10/10 would recomend to anyone making their indie games

  • @jean-michel.houbre
    @jean-michel.houbre 4 года назад

    Thank you for this very interesting video. I took a big step in my discovery of editor scripts, but I think I'll have to review it again ^^

  • @elektra81516
    @elektra81516 4 года назад +1

    This is why I use Unity over anything else, love custom editors!

    • @teemuleppa3347
      @teemuleppa3347 3 года назад

      Unity is not the only engine that allows this

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

    1:23 "CHANGE THESE FUCKERS"
    I see what you did there. :D

  • @RobinPortnoff
    @RobinPortnoff 4 года назад

    Thanks, Matt for all the great tutorials. I saw your event sequencing tool whizzing by at the start of the video. Any plan for a tutorial on node-based tools? I would greatly appreciate it!

  • @ChristianRoyUtah
    @ChristianRoyUtah 5 лет назад +1

    Wow! I love this! Thank you!

  • @ryancassidy3033
    @ryancassidy3033 5 лет назад

    Great stuff, man. Definitely going to try to utilise this!

  • @awesomedata8973
    @awesomedata8973 5 лет назад +2

    This is great, but it should really show how to make the ScriptableObject list of classes. Maybe provide some details?

    • @GameDevGuide
      @GameDevGuide  5 лет назад

      Hey, so there's a Discord server for the community linked in the description which was set up for follow ups on videos such as this, and to discuss video topics in more detail.
      We're also actually discussing this over there too, so you might find it useful. Feel free to join if you wish to get involved. 😊

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

    I find the legendary developer teacher

  • @arthur-monteath
    @arthur-monteath 9 месяцев назад

    I love your channel!

  • @silverfoxstudio4452
    @silverfoxstudio4452 3 года назад

    So this is the video that every AssetStore publisher watch for make a editor window

  • @Andrew90046zero
    @Andrew90046zero 4 года назад +1

    I would like to see how you made some of those node graphs in the intro. If you did actually make those. or other magical looking editors that you've made.

  • @ramonmelofpv
    @ramonmelofpv 4 года назад

    Super nice! Thanks for the tutorial ! :)

  • @blincey
    @blincey 4 года назад

    This video was exactly what I was looking for! I would really love it if you went into more detail about the individual features of the Unity Window editing; or other such features :)

  • @gonzaloescamilla8488
    @gonzaloescamilla8488 4 года назад +4

    I just fouund this channel. Its Amazing!"!!

  • @Sean-hd1bp
    @Sean-hd1bp 4 года назад

    Wow! This is so useful!

  • @logan4179
    @logan4179 3 года назад

    Nice tutorial, but I felt a bit lost. I can't find any good, authoritative videos/courses on Unity editor scripting that go from the ground up. Were there any that you learned and would recommend, or did you just have to piece together info from what you could find?

  • @potatoking5602
    @potatoking5602 4 года назад

    This whole video is very meta, very useful too tho

  • @GreenClover0
    @GreenClover0 3 года назад +1

    I have the impression that we are quite similar. I like to create systems that I can improve later on. I think I like it even more than the game development itself. So I'm glad I found this channel by accident while working on my first custom editor. Keep up the good work

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

    great info!!! tnx a lot!!!

  • @owendugmore1057
    @owendugmore1057 4 года назад +1

    Great video. Is it just me, or is custom editor scripting not very well documented in the official Unity docs?

  • @MDSky
    @MDSky 3 года назад

    8:20 that looks good, but if you could be so kind as to exsplain how to change the boxes background colours that would help alot.

  • @Rajivrocks-Ltd.
    @Rajivrocks-Ltd. 4 года назад

    Very insightful video!

  • @tae6175
    @tae6175 4 года назад +8

    Me just learning Unity and have basic C# knowledge watching this video: yeah.. I have no idea what's he talking about.

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

      this is me right now so im just copying his script and seeing if it works.
      spoilers: it doesn't

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

      @@Senayoshy 😂relatable

  • @victorgonzalezrivera6806
    @victorgonzalezrivera6806 4 года назад +1

    I have a problem in 6:17 where you put the string parameter "gameData" in findProperty, I dont understand what are you referring with that. Hope you can answer me. Thank you so much for the vid!

    • @TheRandomCS
      @TheRandomCS 4 года назад +1

      Its the name of the list in his game data class, you can see the inspector for it at 2:32. The signature being something like 'List gameData'. You want the lower case version since that's the variable name.

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

    Is there a video on how to manipulate scene objects in an editor window? I would love to create an event sequencer.

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

    I wish there were more videos about property drawers instead of editor windows. Way more often than not I want to display properties in within existing editor windows

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

    Any chance that you could release the source code so I can check my files? The use case isn't related to mine
    Specifically trying to use this type of window to open from a "Menu" item and grab all of its value so I can further sort groups separated by headers and change them more easily.

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

    Such a helpful tutorial thank you! Question tho, I got everything working and I have a list of "SkinComplexes" and each of them contain scriptable object class "Skin". When I click on the button then all the Skin values are shown and I can put Skin scriptable object in it. Now I want similary to get "Skin" properties displayed if I have assigned it but I have tried so many things and still can't access those properties. Do you have any ideas how I could access them and display them?

  • @TESkyrimizer
    @TESkyrimizer 4 года назад +1

    That was the greatest thing I have ever seen. Holy crap.

  • @LuizMoratelli
    @LuizMoratelli 4 года назад

    Please, do more videos about of it.

  • @sandwich9560
    @sandwich9560 4 года назад

    For those wondering how to refresh the Editor Window(the field being edited will not change it values) when you clicked on the sidebar button,
    protected void DrawSideBar(SerializedProperty prop)
    {
    foreach (SerializedProperty p in prop)
    {
    if (GUILayout.Button(p.displayName))
    {
    _selectedPropertyPath = p.propertyPath;
    //Add this
    EditorGUIUtility.editingTextField = false;
    }
    }
    if (!string.IsNullOrEmpty(_selectedPropertyPath))
    {
    SelectedProperty = SerializedObject.FindProperty(_selectedPropertyPath);
    }
    }

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

    The editor is blank. It does not draw anything. In fact, even the button does not appear in inspector.

  • @dominiauk
    @dominiauk 5 лет назад

    Brilliant stuff.

  • @simoncodrington
    @simoncodrington 4 года назад

    Awesome video mate. Haven't seen many editor / gui unity videos. Keen on seeing what you come up with next.

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

    Also, in case I wasn't the only one confused about the lastPropertyPath check thing (the "stop child properties from being drawn over iteration") and ALSO ran into the exact problem I did with the array/collection elements within the list we are currently trying to slap into our editor window repeating itself just like he said we were trying to avoid (I have a list within the list I'm trying to draw here), here is was I found out:
    TLDR: Add
    lastPropertyPath = p.propertyPath;
    inside
    foreach (SerializedProperty p in prop)
    {
    if (p.isArray == true && p.propertyType == SerializedPropertyType.Generic)
    {
    ...
    My poor explanation of why:
    (1) The idea behind the lastPropertyPath check in the else statement of DrawProperties is that it a) checks that the lastPropertyPath has been set somewhere (by checking that it isn't empty like we initialized it to be) and b) checks that the latest property path we looked at in the last loop (hence the name lastPropertyPath) we were working with is actually contained in the property path we are looking at right now.
    The idea behind b) is we are trying to see if the current property's path (the p.propertyPath) shows that it is a "child" of the lastProperty path we drew. If it is, that means it must be a child of an array/collection. NOTE: This assumes that lastPropertyPath ALWAYS contains the path of the last property we were looking at in the loop, so we can always compare the current property path (p.propertyPath) to the previous property path (lastPropertyPath). So, if the lastPropertyPath happened to be that of an array/collection, and the current property path CONTAINS that exact path within it, that means the current property path MUST be a child of a collection! If that is the case, it should have already been drawn in the previous if statement (we are in the else statement now), so we want to avoid redrawing it as if its a singular property (which is exactly what the code AFTER this check does for you if your property isn't a child of anything and is just a good old fashioned non-collection-related SerializedProperty). Boom! That explains how that whole "stop child properties from being drawn over iteration" is supposed to work.
    HERE IS WHY I found out the code didn't do that very thing I explained it was going to do...
    The Problem:
    We only assigned lastPropertyPath in two places: (1) when we initialized it to be empty before entering the foreach loop and (2) when we were in the case that the current property wasn't related to a a collection at all (that whole lastPropertyPath = p.propertyPath after the check we described with the "continue"). We never assigned lastPropertyPath when we were dealing with an array/collection! That means lastPropertyPath will never ever correspond to a collection, which means the check that is meant to see if the current property path contains an array's property path will never work. Your lastPropertyPath will never be that of a collection.
    Because of that, we will never be able to check b) properly. It's whole point is to see if the current property's path shows its a child of a collection, which is found out by seeing if the property's path contains the last collection's path.
    The simple fact is, lastPropertyPath needs to hold up to its name of always containing the propertyPath of the last property we were looking at, whether it satisfies p.isArray or not.
    So... TLDR... just make sure lastPropertyPath is being assigned inside the if(p.isArray == true ...) part of the foreach loop, as well as every other possible part.
    Phew, that was a lot of words. Like I said, "poor explanation" XD

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

    How would I get this to work with a ScriptableObject that is not set up as an array?

    • @LuisVasquezVega
      @LuisVasquezVega 3 года назад +1

      Did you find a solution? I make it work but serialized values inside nested groups are getting draw in the sidebar.

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

    When I add a new object to the list via a gui button it doesn't update the sidebar. How can I fix this? The button operates on a reference to the scriptable object assigned when opening the window.

  • @badrballish9328
    @badrballish9328 3 года назад

    Thank you very much.

  • @invntiv
    @invntiv 4 года назад

    How is this channel not massive

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

    how did you created those buttons "Play&Simulate", "Mission Control" and "Scene Collections" if anyone knows how to do that ?

  • @DamienPup
    @DamienPup 4 года назад +1

    how do you make it so you can chage the amount of elements in a array?

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

    I tried to follow this tutorial but my data isnt a list called gameData, I have no idea how to translate any of this to fit the shape of MY data. Can someone explain how to make this work for any other content that isnt a list called gameData?

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

      I just worked through the tutorial and from what I can tell it requires a bit of modification either way working in versions after the one the video was recorded in (though I'm not sure). This Discord in the description does have channels specifically for this sort of help if you need it.

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

    please can you explain to me what is the gameData on line 17 GameDataEditorWindow

  • @francyleomatos7104
    @francyleomatos7104 5 лет назад +1

    Please create more videos related to EditorWindown,
    how to put timeline and components please, please, please, please!

  • @minecraftermad
    @minecraftermad 4 года назад

    how would i go about setting the names for the buttons that are drawn? currently i'm trying to just find a property with the name "name" and set it's value as the name if it's a string... but it seems kind of jank

  • @benayamanuel
    @benayamanuel 4 года назад

    Hey man, just got frustated because all my editor scripts (basically all scripts in Assembly-C#-Editor.dll) couldn't find other classes that sit on Assembly-C#.dll. (missing a directive or assembly reference) My editor scripts created just few weeks ago and they did just fine. But this morning this bug showed up and all my editor code is dead. Bcs they couldn't find the base class. Any idea on this ? Thanks

  • @dahiyabunty1
    @dahiyabunty1 4 года назад +1

    sir..
    do you have project on github???

  • @thedazzledazz4719
    @thedazzledazz4719 3 года назад

    I know this is years old so I probably wont get a reply, but how come when other people do this the non editor classes (in this instance "GameDataObject") come up in the autocomplete for others but for me it always comes up with a red line (even though it still works like that, it's annoying to have to repeatedly check the spelling and to manually type out all the functions)...
    Is there a setting I'm missing somewhere?

  • @Gers217
    @Gers217 5 лет назад +2

    How do I change the number of elements of my ScriptableObject?

    • @AmanKumar-tu2og
      @AmanKumar-tu2og 5 лет назад +1

      Add this to the end of DrawProperties Method
      if (GUILayout.Button("Add Item"))
      {
      prop.InsertArrayElementAtIndex(prop.arraySize);
      }
      if (GUILayout.Button("Remove Item") && prop.arraySize > 0)
      {
      prop.DeleteArrayElementAtIndex(prop.arraySize - 1);
      }
      EditorGUILayout.EndHorizontal();
      And, Add these to the start and end of OnGUI method in the customeditorwindow :
      > serializedObject.Update();
      currentProperty = serializedObject.FindProperty("propertyname");
      DrawProperties(currentProperty, true);
      > serializedObject.ApplyModifiedProperties();

  • @kyanrowse4150
    @kyanrowse4150 4 года назад

    Is it possible to use this to change the element name. So if i have an array floats in the inspector i don't have element 0, element 1 etc I can put a name so if someone who doesn't know about the scripts contents can just take one look and be like hey that's what that array index is for.

  • @minecraftermad
    @minecraftermad 4 года назад +1

    for me the edited values revert the changes made to the object when switching between editor and playmode
    i've tried:
    Undo.RegisterCompleteObjectUndo(ObjectThatWasModified, "update Paths");
    and in a custom editor gui i've tried to do:
    serializedObject.ApplyModifiedProperties();
    i've also tried calling the custom editor from the editor window with a handle with both of those on.

    • @JacobSmith-ts2gq
      @JacobSmith-ts2gq 4 года назад

      try calling setdirty when you change the values it should refresh the info

    • @minecraftermad
      @minecraftermad 4 года назад

      @@JacobSmith-ts2gq isnt set dirty deprecated?

    • @JacobSmith-ts2gq
      @JacobSmith-ts2gq 4 года назад

      @@minecraftermad dont know, but it i had the same problem in one of my projects and it worked

    • @JacobSmith-ts2gq
      @JacobSmith-ts2gq 4 года назад

      also if you are referencing custom classes they should have a [System.Serializable] ubove it

  • @mdistudio7875
    @mdistudio7875 4 года назад

    Hi bro thanks so much for this tutorial,
    But how can i make array of inheritance classes
    Ex.
    Public class base :MonoBehaviour
    {
    //some data
    Public child[] _child
    [system. Serializeble]
    Public class child : base
    {
    //some data
    Public subChild _subChild
    [system. Serializeble]
    Public subChild : child
    {
    //some data
    }
    }
    }
    And to access them?

  • @theman2636
    @theman2636 4 года назад +1

    This is kinda old now why don't you make a video on the same subject but with UIElements

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

    how should i structure my data so that this works? no matter how many times i've tried to implement this it never works for me. something is always broken. Either arrays and lists duplicate themselves or they don't show up at all. and if i try to add the sidebar, none of the fields show up. i'm completely lost.

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

      I had a similar issue, and it seems to be because I was using nested scriptable objects. You need to use a serialized class for it to work. This is how my class looks:
      [System.Serializable]
      public abstract class CutsceneAction
      {
      public string name;
      public float duration;
      public abstract IEnumerator Play();
      }
      This shows up properly

  • @realog7692
    @realog7692 3 года назад

    I want to edit inspector things in in-game setting like
    Controlling poset possessing with toggle or camera view distance

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

    nice easter egg at 1:24😅

  • @nove1398
    @nove1398 4 года назад +1

    How Do I populate the the list though?

  • @AllDayBikes
    @AllDayBikes 3 года назад

    "Change these fuck**s" nice haha

  • @vladisslavss
    @vladisslavss 4 года назад

    Great!

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

    If only GameDataObject was shown for a single frame... but nope.

  • @tayyabmujeeb7621
    @tayyabmujeeb7621 3 года назад

    can we convert editor window into canvas?

  • @lewaplay
    @lewaplay 4 года назад

    I'm trying to do this for 5 days and it still doesn't work

  • @silverfoxstudio4452
    @silverfoxstudio4452 3 года назад

    Why you don't zoom the ide ?

  • @hojaverde5265
    @hojaverde5265 5 лет назад

    Are you using Odin serializer? I want to get it but I'm not totally sure

    • @GameDevGuide
      @GameDevGuide  5 лет назад

      Nope this is just default unity!

    • @joaniepepin4968
      @joaniepepin4968 4 года назад

      Probably late, but I got it at the latest sale and I must say, I am getting way more use out of it than I ever thought I would! Adding a button in the editor with one line of code allows to do so many things that I never would have thought possible and it saves a lot of time in the long run!

  • @Shonnyy
    @Shonnyy 3 года назад

    "Change these fuckers" lol

  • @nove1398
    @nove1398 4 года назад

    [selectedProperty.FindPropertyRelative] this method is not finding the property name that I passed in.

  • @ruchirraj5300
    @ruchirraj5300 4 года назад

    Please make some more editor tool windows

  • @jibbyis_2327
    @jibbyis_2327 3 года назад

    MY BRAIN HURTS SO MUCH FROM JUST 10 MINUTES

  • @tayyabmujeeb7621
    @tayyabmujeeb7621 3 года назад +1

    Any one who can help regarding this?

  • @Inf4mousKidGames
    @Inf4mousKidGames 4 года назад

    Umm where the heck does currentProperty come from???
    it wasnt even defined

    • @Lelefant_
      @Lelefant_ 4 года назад +1

      It is defined in ExtendedEditorWindow as protected variable, so it can be used in the deriving EditorWindow. (see 7:19)

    • @Inf4mousKidGames
      @Inf4mousKidGames 4 года назад

      @@Lelefant_ I did a dumb I named the variable something else 🤣

  • @SLAYERSARCH
    @SLAYERSARCH 3 года назад

    10000000000 menu's and all i want is a search button.

  • @pedroluzio
    @pedroluzio 4 года назад

    can you show the contents of "Game Data" ?

  • @wombatbat6955
    @wombatbat6955 4 года назад

    How come I'm only now finding about this channel? This is Brackeys level tutorial!

    • @TheAdeOfSpades
      @TheAdeOfSpades 3 года назад

      Brackeys is for excitable noobs.
      This is next level.
      Not many make it to the next level.

  • @momonyaro
    @momonyaro 4 года назад

    b r u h