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
@@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
@@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 :)
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.
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!
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.
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
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! :)
@@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...
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
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.
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! :)
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.
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")
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.
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 😳
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.
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
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
Great tutorial! But dang Unity needs to make this way easier imo, I hope one day they make it a simple property attribute
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.
Ahh! This is the one you were talking aboot. Love it!
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 :)
@@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
Love the tutorial! Quick and concise but explains enough to understand!
Glad you found it useful, what are you creating?
@@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 :)
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.
Thanks for the tip, my friend! :)
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!
Thanks for sharing, my friend! :) I really appreciate it and I hope it will help others out too.
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.
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
Mannnn your projects are probably so clean and organized, some really useful info yet again, thanks brother!
Haha, is it spaghetti junction up in there? :P
@@SpeedTutor no way, it’s hard enough to find things with clean code....spaghetti has been off the menu awhile now lol
Spaghetti is over-rated anyway!
Odin inspector is the best tool to make editors easily
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! :)
Thanks, it's so useful and also easy to understand!
I'm glad you've found it useful, thanks for watching my friend! :)
Odin for the win... along with ScriptableObjects, these two things have revolutionized my development workflow.
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?
@@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...
@@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.
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
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.
That's a great idea!
Underrated.
I hope you found it useful! :D Are you creating something cool?
Thank you so much. It's so helpful
You're very welcome! :D What are you looking to make?
good video again! Thx my friend.
No worries dude! :)
Really helpul
I'm glad you found it helpful! :D
Super
thank you
You're very welcome, thanks for checking this out! :D
Can you enable the closed caption, please? I am Deaf.
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! :)
@@SpeedTutor it was greyed out but now it is on, thank you!
I guess it just takes time to appear! Thanks for sticking with it, my friend! :)
hmm soo the data we mentioned in inpector will be save rgiht ? and If we put on every object data will be accordingly...
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.
nice!
Thanks very much! :)
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")
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.
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 😳
The more you know! Thanks, my dude. Really awesome pointer, right there!
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.
Useless because it works UnityEditor only...
I'm not sure where else you expected a custom Unity editor inspector to work?
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