0

After creating an asset object in the assets folder of a scriptable object class, we can see and edit the values of the fields of that scriptable object. Then we can reference that object in different scripts and read/write its values.

So, I wondered if there was a way to see and edit that asset object's fields in that script's inspector without having to select that asset object in the assets folder. Like Unity will serialize that scriptable object as it does for other serializable fields like int, float, List etc.

Can anyone tell me if it is possible and if possible, how?

Fahim kamal Ahmed
  • 195
  • 1
  • 2
  • 6
  • I know the answer to this question and its implementation, but it takes a long time. For guidance, see [Custom Editor](https://docs.unity3d.com/Manual/editor-CustomEditors.html) in Unity. You must create a Custom Editor for your Scriptable Object and Script. If you don't have time to do this, don't forget to visit [Odin Inspector](https://assetstore.unity.com/packages/tools/utilities/odin-inspector-and-serializer-89041) in the Asset Store. – KiynL Mar 22 '23 at 20:50

1 Answers1

1

It is a quite complex process to learn and implement, but if you want to start somewhere, you can look at the NaughtyAttribute package. It does more than you need but it has this [Expandable] attribute which does exactly what you described. If it does too much, you can easily extract the behaviour and only keep that.