I have found an interesting "issue" in UnityEditor regarding Scriptable objects. Below is simple example:
I have scriptable class ScriptableExpressionBulder that holds some list and a float field. Then I have another class ScriptableExpressionCreator that holds a LIST of scriptable objects mentioned previously. The code looks like this:
public class ScriptableExpressionBuilder : ScriptableObject
{
public List<MultipleExpressionBuilder> multipleExpressionBuilder;
public float delay;
}
public class ScriptableExpressionCreator : ScriptableObject {
public List<ScriptableExpressionBuilder> List;
}
When creating ScriptableExpressionBuilder the fields from (MultipleExpressionBuilder) comes up nicely but it also adds a second field "delay" at the end (which is perfect to this point).
Now for the interesting part:
The second class ScriptableExpressionCreator holds a list of previous scriptables but it doesn't serialize the "delay" field in this current scriptable. The only field that is serialized is a Scriptable class.
Is there a way to serialize the field from ScriptableExpressionBuilder in another Scriptable that holds a list of these scriptables so I can basically set the delay from where this expressions are called. I could however populate the field in the inspector of original scriptable, but the wouldnt be reusable since each delay is different.
CodePudding user response:
You had the question deleted but I voted to reopen it since I already had started to write the solution and finished just when you deleted it and I think this now does what you want and gives you a good start point for further extending it where needed ;)
That's not really an issue, however, not possible built-in.
For ScriptableObject
(and anything else that inherits from UnityEngine.Object
) the Inspector by default draws an object field. If you want to draw something else you would need a