Asset Inheritance - No Boilerplate Material and ScriptableObject variants

Hello, I have been working on a editor extension that lets you create variants of ScriptableObjects and Materials like you do with prefabs. The values of the variants stay in sync with the values of their base, and changing a value of a variant will override it just like with prefabs.
Note that this is editor only just like prefabs. However it requires 0 bolierplate to work, just drop it in and you can make variants of any of your existing ScriptableObjects or Materials.

Demo
In this example “C” is a variant of “B” which is a variant of “A”. Changing a property on “A” will change the property on both “B” and “C” assume that neither override that property.

In the gif it may look bit janky as the values update but that is just because the properties don’t update until the next frame, it is actually quite solid so far.

Still To Do
-̶ ̶A̶p̶p̶l̶y̶:̶ ̶S̶t̶i̶l̶l̶ ̶n̶e̶e̶d̶ ̶t̶o̶ ̶a̶d̶d̶ ̶t̶h̶e̶ ̶"̶A̶p̶p̶l̶y̶"̶ ̶b̶e̶h̶a̶v̶i̶o̶r̶ ̶t̶o̶ ̶a̶p̶p̶l̶y̶ ̶a̶ ̶o̶v̶e̶r̶r̶i̶d̶d̶e̶n̶ ̶v̶a̶l̶u̶e̶ ̶t̶o̶ ̶t̶h̶e̶ ̶b̶a̶s̶e̶ ̶a̶s̶s̶e̶t̶.̶ :: Added

̶-̶ ̶P̶l̶a̶y̶M̶o̶d̶e̶:̶ ̶N̶e̶e̶d̶ ̶p̶r̶e̶v̶e̶n̶t̶ ̶t̶h̶e̶ ̶s̶y̶s̶t̶e̶m̶ ̶f̶r̶o̶m̶ ̶w̶o̶r̶k̶i̶n̶g̶ ̶i̶n̶ ̶p̶l̶a̶y̶m̶o̶d̶e̶ ̶a̶n̶d̶ ̶i̶n̶s̶t̶e̶a̶d̶ ̶c̶a̶c̶h̶e̶ ̶c̶h̶a̶n̶g̶e̶s̶ ̶t̶h̶a̶t̶ ̶h̶a̶p̶p̶e̶n̶ ̶i̶n̶ ̶a̶n̶d̶ ̶a̶p̶p̶l̶y̶ ̶t̶h̶e̶m̶ ̶a̶f̶t̶e̶r̶ ̶e̶x̶i̶t̶i̶n̶g̶ ̶s̶o̶ ̶t̶h̶a̶t̶ ̶a̶l̶l̶ ̶S̶O̶s̶ ̶b̶e̶h̶a̶v̶e̶ ̶t̶h̶e̶ ̶s̶a̶m̶e̶ ̶a̶s̶ ̶t̶h̶e̶y̶ ̶w̶o̶u̶l̶d̶ ̶i̶n̶ ̶a̶ ̶b̶u̶i̶l̶d̶.̶ - :: Added

- Tests: Since this deals with data and is a rather complex system I want to make sure that it is well tested as to not mess up anything. But so far it is seeming very stable. :: Partially Completed

- Odin Support: Odin is widely used especially for more data heavy projects, so I want to make sure that it is fully supported to provide the best experience. :: Almost Complete

- Ancestor Dropdown: Add a dropdown window to inspector for objects that mimics the new 2022 Material variant window. This lets you get a nice overview of what ScripableObjects inherit from which. :: Partially Completed

- Property Locking: Unity’s 2022 material variants have a nice feature of allowing locking of properties so they are not able to be affected. This seems like a nice feature to add and I have a number of ideas of how to implement it.

3 Likes

I had to take a break due to working on another project, but I will be continuing work now.
Since Unity announced material variants in 2022.1, I will be dropping support for them. Material variants were difficult to support given the variety of different forms their data takes, and to get the UI to work required a lot of hacking and was still a bit subpar still to be honest.
I will try to adopt the styling and features of the Unity Material Variants as best I can so that ScriptableObject variants will fit in seamlessly with the rest of the editor!
Stand by for more updates soon!

2 Likes

After doing some general cleanup and removing Material support, I now have “Apply” working! Works just like you would see with prefabs.
h55hid

(For context in the video, “C” and “B Variant” are both variants of “B”, which is a variant of “A”)

1 Like

Where can you find this asset?

Hey, thanks for your interest. It isn’t currently out yet however it is getting close to complete, I would say about 3 more weeks before seeing it on the asset store.
I will be doing another update or two here before then though.

Starting early next week I will be looking for ‘beta’ testers, so if anyone is interested please feel free to message me and we can discuss :slight_smile:

1 Like

Hi! I’d be interested in testing it :smile:

Messaged :slight_smile:

Update!
I have now finished one of the last remaining large features, and that is the hierarchy popup window. It mirrors Unity’s 2022.1 Material Variants popup an allows you to see all of the ancestors and children of a ScriptableObject.

Also of note, the Parent field is how inline in the header instead of being on a new line, this helps it look cleaner and be more compact. However, if there is a custom editor that has a custom header, the field will be put on a new line as to not interfere with anything!

There are a bunch of small changes, testing, code cleanup, etc. that have also happened, along with stuff that is not ready to be shown off yet. But things are going well and it is getting close to finished!

2 Likes

Awesome utility! Can I test it?

Looks interesting, but how it differs from: Asset Variants | Utilities Tools | Unity Asset Store ?

Is there a github for that?