@@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.
@@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.
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.
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!
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...
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
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!
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. 😊
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.
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 :)
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?
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
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!
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.
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
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.
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?
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); } }
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
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.
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?
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.
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
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
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?
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();
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.
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.
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?
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.
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
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!
Please, it would be awesome if you could create more detailed videos on how to create custom editor in Unity.
i would really like a tutorial playlist on a more or less "full" game of GameDevGuide
The information from the video is enough to program your own custom editor. You just need your own ideas lmao
@@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.
@@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.
@@dragonboyx123 did you find any thing useful ?
Would love a more in depth video showing all the different kinds of things you can do!
I just found this channel and i love it already.
You explaining everything very well.
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 😭😭
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.
i like how you show the problem you encounter first, then present a solution, very well-made video!
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!
Did no one else see that comment at 1:24? "Change these fuckers". A game dev in my liking.
Would like to see more videos from you on this subject...really awesome work!!
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!
I just found you, amazing tutorials. Subscribed!
I always find you when i most needed, you're best
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...
High quality video dude, I really appreciate the time you're taking to make these.
I've been looking for this for a week now ARRRGH
Thank you!
You just blew my mind mate.
Didn't find what to see
Exactely what i was looking for thanks soo much
You gave it in fantastic presentation
would you cover how to build those node editors? That looks that it'd be immensely useful!
Thanks for the videos!
Thank you so so so so much, this and every single one of your tutorials are really awesome, I cannot thank you enough!
Really useful for organizing, thanks for the tutorial!
You just destroyed all my doubts, thanks 🤘
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
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 ^^
This is why I use Unity over anything else, love custom editors!
Unity is not the only engine that allows this
1:23 "CHANGE THESE FUCKERS"
I see what you did there. :D
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!
Wow! I love this! Thank you!
Great stuff, man. Definitely going to try to utilise this!
This is great, but it should really show how to make the ScriptableObject list of classes. Maybe provide some details?
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. 😊
I find the legendary developer teacher
I love your channel!
So this is the video that every AssetStore publisher watch for make a editor window
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.
Super nice! Thanks for the tutorial ! :)
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 :)
I just fouund this channel. Its Amazing!"!!
Wow! This is so useful!
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?
This whole video is very meta, very useful too tho
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
great info!!! tnx a lot!!!
Great video. Is it just me, or is custom editor scripting not very well documented in the official Unity docs?
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.
Very insightful video!
Me just learning Unity and have basic C# knowledge watching this video: yeah.. I have no idea what's he talking about.
this is me right now so im just copying his script and seeing if it works.
spoilers: it doesn't
@@Senayoshy 😂relatable
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!
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.
Is there a video on how to manipulate scene objects in an editor window? I would love to create an event sequencer.
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
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.
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?
That was the greatest thing I have ever seen. Holy crap.
Please, do more videos about of it.
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);
}
}
The editor is blank. It does not draw anything. In fact, even the button does not appear in inspector.
Brilliant stuff.
Awesome video mate. Haven't seen many editor / gui unity videos. Keen on seeing what you come up with next.
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
How would I get this to work with a ScriptableObject that is not set up as an array?
Did you find a solution? I make it work but serialized values inside nested groups are getting draw in the sidebar.
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.
Thank you very much.
How is this channel not massive
how did you created those buttons "Play&Simulate", "Mission Control" and "Scene Collections" if anyone knows how to do that ?
how do you make it so you can chage the amount of elements in a array?
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?
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.
please can you explain to me what is the gameData on line 17 GameDataEditorWindow
Please create more videos related to EditorWindown,
how to put timeline and components please, please, please, please!
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
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
sir..
do you have project on github???
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?
How do I change the number of elements of my ScriptableObject?
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();
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.
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.
try calling setdirty when you change the values it should refresh the info
@@JacobSmith-ts2gq isnt set dirty deprecated?
@@minecraftermad dont know, but it i had the same problem in one of my projects and it worked
also if you are referencing custom classes they should have a [System.Serializable] ubove it
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?
This is kinda old now why don't you make a video on the same subject but with UIElements
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.
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
I want to edit inspector things in in-game setting like
Controlling poset possessing with toggle or camera view distance
nice easter egg at 1:24😅
How Do I populate the the list though?
"Change these fuck**s" nice haha
Great!
If only GameDataObject was shown for a single frame... but nope.
can we convert editor window into canvas?
I'm trying to do this for 5 days and it still doesn't work
Why you don't zoom the ide ?
Are you using Odin serializer? I want to get it but I'm not totally sure
Nope this is just default unity!
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!
"Change these fuckers" lol
[selectedProperty.FindPropertyRelative] this method is not finding the property name that I passed in.
Please make some more editor tool windows
MY BRAIN HURTS SO MUCH FROM JUST 10 MINUTES
Any one who can help regarding this?
Umm where the heck does currentProperty come from???
it wasnt even defined
It is defined in ExtendedEditorWindow as protected variable, so it can be used in the deriving EditorWindow. (see 7:19)
@@Lelefant_ I did a dumb I named the variable something else 🤣
10000000000 menu's and all i want is a search button.
can you show the contents of "Game Data" ?
It´s my doubt too
How come I'm only now finding about this channel? This is Brackeys level tutorial!
Brackeys is for excitable noobs.
This is next level.
Not many make it to the next level.
b r u h