I have a little issue I can’t seem to work around.
In my game, I have a ScriptableObject for my Weapon. In this, there is a field for another SO for the DamageType.
I would like in my Weapon editor to show the parameters of my DamageType SO when I put one into the field. The problem is each time I want to edit the variables of my DamageType, I have to go to select it and it changes the editor. I’d like it to appear on the Weapon editor.
Note : DamageType is a mother class with 3 children (Fixed, Fork and Dot) with each one of them different variables to draw.
For this you have to write custom inspector for your Weapon script and after drawing object reference field for SO, you should call it’s inspector if reference value is not null. This way the inspector for referenced object will be drawn inside the inspector of object holding the reference
var editor = Editor.CreateEditor(property.objectReferenceValue);
var serializedObject = editor.serializedObject;
This creates a editor whaterver copnfigured for the object referenced by property and after that you can draw it’s properties or whole inspector as you normally do it with serialized objects.