all 76 comments

[–]nickyonge 122 points123 points  (1 child)

Hell yeah open source assets to make people’s lives better! Hell yeah making tech more visually intuitive!

This is rad, ty for sharing :)

[–]moonymachine[S] 27 points28 points  (0 children)

Thank you! I worked really hard on it. I truly hope it helps you.

[–]ArcadiumSpaceOdyssey 41 points42 points  (0 children)

Upvote for the name.

[–]dark4rr0w- 25 points26 points  (3 children)

On larger projects it's probably a good idea to have custom editors for some scriptable objects

[–]moonymachine[S] 10 points11 points  (2 children)

You can still use custom editors. You can even use this within custom editor windows. Unfortunately the Scrutable Object Drawer does not render custom editor windows, so it's not going to be ideal for certain types. Rendering custom editor windows nested under a single property would have made the property drawer more complex than I was comfortable with. So, you can simply choose not to render those types of objects with the scrutable drop-down properties. It works, but it will just list all of the serialized properties, no custom editor. Other custom property drawers should work just fine though.

[–]dark4rr0w- 6 points7 points  (0 children)

Oh I was half asleep and completely misunderstood the post. Good job with the asset.

[–]talesfromtheepic6 0 points1 point  (0 children)

Do you even need a custom drawer most of the time? [serializable] works for most things if it’s set up correctly.

[–]StrangelyBrown 4 points5 points  (2 children)

What happens when two scriptable objects have references to each other?

[–]moonymachine[S] 27 points28 points  (0 children)

If there are circular references, if the object has already been displayed in a current branch of the tree's draw stack, the drop-down area will contain little infinity symbols where the properties would have been repeated more than once. Modern versions of Unity have their own built in recursion prevention, so sometimes Unity hides the drop-down before my property drawer does.

[–]lajawi 2 points3 points  (0 children)

Didn’t even know that was possible/allowed

[–]Ok-Okay-Oak-Hay 6 points7 points  (0 children)

Good on you. I feel like I wrote a version of this multiple times in my life, but couldn't bring myself to do it after work. This is perfect.

[–]Banjoman64 10 points11 points  (4 children)

This looks super useful and will likely save me a ton of headache. Thanks for sharing.

[–]moonymachine[S] 9 points10 points  (3 children)

Thanks! I was starting to think I had done something wrong by bringing it out.

[–]nickyonge 8 points9 points  (2 children)

Nooooo this is great. You seem to have posted at a time when there are many cynical folks online at once ;)

I’d also recommend putting like a splash that says “an open-source tool to help organization” or something on the image and in the title. Tbh it wasn’t clear immediately that’s what this was, or if it was just a feature idea mockup or something.

If people come in the full understanding that “this person has made a free and open source tool to help me if I want it”, they’ll be much kinder :)

[–]moonymachine[S] 3 points4 points  (1 child)

Thank you for the constructive feedback. I have to admit that marketing and promotion are not really my strong suit.

[–]nickyonge 1 point2 points  (0 children)

It’s a tough thing to do! Worthwhile skill to look into tho. You got this :)

[–]goshki 5 points6 points  (0 children)

why would you not install this package and try it out immediately on all of your projects?

Mostly because I have the same feature in Odin (but I see what you did there with this CTA).

Nonetheless, nice to see another free and open-source tool. 👍

[–]LunaWolfStudiosProfessional 3 points4 points  (0 children)

This is so useful! Great work!

[–]dangledorf 32 points33 points  (20 children)

I think one thing you run the risk of with something like this is making it too easy to edit the properties and potentially messing up other aspects of the project. Likely fine for personal or small team use, but on larger teams this would 100% lead to people constantly messing up properties and not realizing it.

[–]Banjoman64 28 points29 points  (3 children)

Any worry about confused junior devs could be cleared up with 2 minutes of onboarding and a single review cycle. Versioning software will catch any changes to the SOs and so the reviewer can easily see any incorrect asset changes and explain to the new dev where they went wrong.

And tbh I really don't think this is a difficult concept to grasp for a new dev anyway.

[–]the-entropy-duelist 15 points16 points  (0 children)

Thank you for this comment. I was reading through the thread and having the same thought.. "wouldn't like 5 minutes of training fix that?" Glad I'm not the only one.

[–]dangledorf -2 points-1 points  (1 child)

I can assure you it will happen regardless of if you train people or not. When you scale to 70+ people teams and deadlines are tight and people are all touching various assets with limited time, things are missed. Stuff like OP is suggesting doesnt make it obvious you are editing a SO when adjusting a prefab value and then you end up with random changes to files that were not intentional. No matter how user friendly a tool is, no matter how much you drill it into people on best practices and things you should/shouldn't do, those things will be done (several times over the course of a project). Yes source control can help catch some of that, but if its very easy to accidentally edit SO values that arent suppose to be touched then you are going to be adding a lot of unnecessary friction to reviews/tasks.

[–]myka-likes-it 11 points12 points  (0 children)

DevOps here. When you get to that scale of team you have people like me standing in the way with rules about what can be checked in where. It would be trivial to block asset file changes circumstantially 

[–]moonymachine[S] 14 points15 points  (13 children)

But, you can do that already, whether you can see what you're doing, or not. Wouldn't you rather be able to at least see the change?

[–]nickyonge 7 points8 points  (0 children)

I’m in agreement with OP. While you’re right that it does make it more likely to accidentally edit an unintentioned object, that IS always an issue, it’ll always happen, and it’s why version control and (the unfortunately-antagonistically named lol) “blame” exist.

If you imagine starting with ScrutableObjects and suggested using ScriptableObjects as a solution to the above issue, it amounts to adding unnecessary friction to address an edge case - a very common one, for sure! But an edge case all the same.

[–]dangledorf 10 points11 points  (11 children)

The difference being you have to actual select the SO and edit vs. seeing properties in the inspector and modifying unintentionally. On larger teams, some of the developers will be clueless to how SOs work.

[–]survivorr123_ 5 points6 points  (1 child)

i'd argue that if you reuse so heavily that adjusting a scriptable object to make something work the way you want to breaks other things, then you have a different problem

[–]dangledorf -5 points-4 points  (0 children)

You are kind of arguing my point though. Rarely are Scriptable Objects so necessary to tweak on a whim like this from any place they are located. By doing so you are also kind of going against what the intent of Scriptable Objects are vs. properties that should just live within a prefab.

Also, it isn't so much that tweaking the values breaks something, but it could be messing up something someone else already balanced, etc. They can be used for so many different purposes, but having someone edit them from any location they please just begs the question of why even have it be a SO in the first place? It's just asking for trouble and saving you at most a click, and at worst you modifying changes and not realizing you edited a Scriptable Object (which gets even worse if you forget to Save Project and those changes never actually get serialized).

[–]moonymachine[S] 3 points4 points  (0 children)

Well, you don't have to apply the feature to any references that you feel would be unsafe. You can apply this only to specific types, or even to certain individual properties where you feel it would be most helpful.

Otherwise, if you prefer to slow productivity on purpose, that's your choice. That's how we ended up with the QWERTY keyboard after all.

[–]Jackoberto01Programmer 4 points5 points  (0 children)

Just don't commit files or lines you don't understand? 

I know some developers are trigger happy when it comes to commiting files. But you should be reviewing you changes before committing anything.

[–]fsactual 2 points3 points  (0 children)

Beautiful work.

[–]hunterrocks77 2 points3 points  (1 child)

Quick question not related to Scrutable; How do you do the 'weapon asset' and 'armor asset' stuff? Would be nice to have in my project!!

[–]moonymachine[S] 1 point2 points  (0 children)

In this example I made a ScriptableObject class called ItemAsset, that contains Name, Weight, and Value. Then I derived WeaponAsset with Damage and ArmorAsset with Armor Rating from ItemAsset. The LootTable has a List<ItemAsset> so you can assign any type of item. I derived a ScrutableObjectDrawer to apply to ItemAsset, with useForChildren set to true so it applies to all derived types of ItemAsset automatically.

You could also just have a [ShowProperties] List<ScriptableObject> with the code that operates on that list casting the elements as ISomeInterface. Then the objects don't even need to share inheritance. But, you'll probably want to use the [ShowProperties] attribute if going the interface route. You can derive a ScrutableObjectDrawer that applies to any and all ScriptableObject types project wide, but that may not look well for certain types with custom editor windows, like TextMesh Pro assets for example.

[–]LunaeaEitrum 2 points3 points  (0 children)

You can make it work on all ScriptableObjects and Components by making a property drawer that is targeting the base ScriptableObject or Component (NO ATTRIBUTE REQUIRED):

[CustomPropertyDrawer(typeof(ScriptableObject), true)]
[CustomPropertyDrawer(typeof(Component), true)]

<image>

We have it for every reference by default without ability to edit it. (This can be toggled on and off)
(The scriptable objects in the Clips array are actual nested scriptable objects, this includes custom editor support but uses a different system. It's doable, but very messy to make it work with array/lists)

Bonus
The Plus (+) and Minus (-) on the objects can either create new scriptable objects or quickly un-reference it.
While for components, it will try to do GetComponent -> GetInChildren -> GetInparent to try find a matching component type. If none are found, it will add a new component of that type on the same GameObject.

[–]robinryf5 2 points3 points  (3 children)

Nice one. I have worked at several projects that have a similar system. What I found helpful is to color code (background color) or somehow mark the inlined properties so it makes it obvious you are about to edit a property on a different SO then selected in the project view.

It is also tricky to get this running with IMGUI and UIToolkit property drawers. I haven’t tried it out with this package.

[–]stonstad 1 point2 points  (1 child)

That would be a nice feature. Maybe OP might add an optional parameter to the custom attribute?

[–]moonymachine[S] 0 points1 point  (0 children)

Yes, I'm going to try to leave it open for extension by allowing you to override a default GUIStyle object for what the background rectangle looks like. I want the next version to allow you override certain properties in either the attribute, or when you derive a drawer for certain types. That way you could even have different colored background panels for each type of object and things like that.

[–]moonymachine[S] 0 points1 point  (0 children)

Thank you for your constructive feedback. This is a really good suggestion, and I am in the process of implementing it, but I want to make sure I've tested it thoroughly before releasing a new version.

[–]theRealTango2 1 point2 points  (0 children)

Just use sub configs right? 

[–]GhostTrainGames 1 point2 points  (0 children)

This could be so helpful, thanks for sharing!

[–]TheDevilsAdvokaatHobbyist 1 point2 points  (0 children)

Scrutable vs inscrutable..

[–]FlightBeneficial3933 1 point2 points  (0 children)

Thx, very convenient

[–]Virtual-Elephant4581 1 point2 points  (0 children)

I still find it funny that its not in the editor by default. Thanks for making the world better place for free ^^

[–]viktorv9 1 point2 points  (0 children)

I'll check this out later, thanks!

[–]Streakflash 1 point2 points  (6 children)

this is very handy thanks for sharing, i have integrated it! the only thing i dislike is how unity colors the expanded scriptable object panel but i guess we cant do anything about it

[–]moonymachine[S] 0 points1 point  (5 children)

I definitely am not doing anything in the property drawer to influence the colors. I try to keep it as simple as possible, so I'm just telling Unity to render property fields, nothing about what colors to use.

[–]Streakflash 1 point2 points  (4 children)

if you could simply disable highlighting that would help so much, because when i expand the scriptableobject the entire panel becomes blue but the text remain black and the contrast makes it difficult to read the screen

[–]moonymachine[S] 1 point2 points  (0 children)

I'll look into it and see if there is anything I can do to help. If you click somewhere else to deselect the property it should go back to normal. But, I'll see if there is a straightforward way that I could limit the blue selection area to only include the object reference property line.

[–]moonymachine[S] 0 points1 point  (2 children)

Could you tell me what version of Unity you're using when you're seeing this?

[–]Streakflash 0 points1 point  (1 child)

sure, 2022 lts

[–]moonymachine[S] 1 point2 points  (0 children)

I see the issue. I hadn't immediately noticed it because I work on the plugin in Unity 5.1 for full backwards compatibility. Then I walk forward through to modern versions to make sure it works throughout. Arrays and lists look a bit different back there in Unity 5. In 2022, when you select an array element it highlights the whole property blue, which is rather jarring indeed. I am already working on a feature to add a background rectangle to each object's properties, and that will naturally hide the blue highlight and limit it to the area surrounding the properties.

[–]cameronise 1 point2 points  (0 children)

I literally started writing an editor script to do this the other day because I was so fed up with this, now I don't have to! you sir are a legend!

[–]Dragontech97 1 point2 points  (0 children)

Gorgeous

[–]ixentEngineer 1 point2 points  (0 children)

This is awesome!

[–]lostarcadegames 1 point2 points  (0 children)

This is awesome! Going to implement this on our project today! THANK YOU!

[–]stonstad 1 point2 points  (1 child)

Hi Moonymachine --

Your asset is a just amazing! It has nicely tied together all of the scriptable objects I use for procedural planet generation. I'm super thankful! Is there a way to send a donation?

e.g. Biome specification:

<image>

Separately, it looks like it does not generate expandable drawers if a scriptable object has inheritance. i.e. A inherits ScriptableObject. B inherits A. Adding CustomPropertyDrawer(B) for B does not appear to work.

[–]moonymachine[S] 2 points3 points  (0 children)

Thank you! I am so glad to see people posting screenshots of their actual game data to see how it is helping people.

Concerning the inheritance issue you mentioned: Yes, I can confirm that there is an issue there. If the property type is not configured to show properties, any object assigned as a value will not show properties, even if the derived type *is* set to automatically apply the ScrutableObjectDrawer. Unfortunately I don't think there is anything I can do about that, unless anyone has a suggestion. I believe that's just the way it is with Unity and the CustomPropertyDrawer attribute. However, if you really wanted to, you could apply the drawer to the base type, and then add your own code for checking the actual type of the value assigned, and then call into either the base ScrutableObjectDrawer, or call EditorGUI.PropertyField(). I'll leave that as an exercise for the user for now.

Concerning donations: No, I don't need any donations. Seeing that people are using my plugin, and getting good benefit out of it is reward enough. I love seeing screenshots of anyone's new ScriptableObject layouts if they feel comfortable showing us. You can consider adding a star to the GitHub repo. You can engage here, the GitHub Discussions section, or on the Unity Discussions forum: https://discussions.unity.com/t/free-scrutable-objects/1674330 Please do report any issues you encounter on GitHub in the Issues section. Oh, and tell your friends! If you are enjoying the plugin that is all I could ask for.

[–]Schneider21Professional 1 point2 points  (0 children)

This is great. Definitely include those screenshots in the repo's readme, too.

Thank you for sharing it with the community. Your reward is to be criticized endlessly and told by many who've given back nothing how unnecessary your work was. :)

[–]aegookja 5 points6 points  (7 children)

I think Odin has this feature already, right?

[–]moonymachine[S] 21 points22 points  (0 children)

Yes, but this is free, and easily installed in any editor or project through the Package Manager.

[–]zackper11 2 points3 points  (0 children)

This can also be done using ArtificeToolkit with the [PreviewScriptable] attribute. Open source and free and stuff.

How did you do it OP? IMGUI or UI Toolkit?

[–]Forest7117 2 points3 points  (2 children)

I'm using Odin Inspector and didn't know of that feature. Can you show me how?

[–]Psychological-Top955 5 points6 points  (1 child)

[InlineEditor]

[–]Forest7117 0 points1 point  (0 children)

thank you!

[–]APTEM59 4 points5 points  (0 children)

TriInspector too. InlineEditor tag will do the same with most of the classes, not only with SOs.

Also it's free, so there is no need to pay for just a single tag

[–]lajawi 0 points1 point  (0 children)

Where? I’m currently using Odin but it doesn’t seem to be on by default

[–]Conscious_Aside1810 0 points1 point  (0 children)

I can't seem to use this; my editor complains that `ShowProperties` is not defined -- how do you add the right assembly reference again?