@gamingislove Hello.
Is there already a way to serialize other data types, which are serializable alongside with IBaseData?
I inherited class from SerializedBehaviour and it draws only the settings (IBaseData).
If do not inherit from it - only the serialized data is drawn.
How do I draw both data types?
I mean without creating custom editor for each component that usses makinom's IBaseData.
So far I made this thing.
It seems to draw both types and serialize them persistently.
public abstract class SerializedMonoBehaviour<T> : SerializedBehaviour<T> where T : IBaseData, new() { }
[CustomEditor(typeof (SerializedMonoBehaviour<>), true)]
public class SerializedBehaviourInspector : BaseInspector
{
public override void OnInspectorGUI()
{
base.OnInspectorGUI();
this.ShowSettings(((SerializedBehaviour)this.target).SerializedSettings, false);
}
}
If this is normal and there is already no other way
Then you could add just one call to base inspector in order to fast fix this problem.
[CustomEditor(typeof (SerializedBehaviour), true)]
public class SerializedBehaviourInspector : BaseInspector
{
public override void OnInspectorGUI()
{
base.OnInspectorGUI();
this.ShowSettings(((SerializedBehaviour) this.target).SerializedSettings, false);
}
}
But still.
It is not that great that we have to inherit from specific SerializedBehaviour in order to draw makinom's BaseData types..
This does not work with Visual scripting for example (the variable was not drawn in inspector for example GeneralConditionSetting) . And will not work with components which must be inherit from different class.
Can this problem be solved somehow?
Maybe with custom Attributes or by making BaseData [Serializable]?
Extending from SerializedBehaviour is also not needed at all. Many of the built-in components don't use it.
ORK/Makinom use it due to Unity's data serializer not going deep enough, e.g. condition setup as they're available would not be possible with Unity's serializer.
If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
@gamingislove
I was trying to use
GeneralConditionSetting condition
in my custom component.
It was not drawn in inspector until I inhereted from SerializedBehaviour and transfered it into subclass and named the variable specifically - "settings".
GeneralConditionSetting<GameObjectSelection> condition
Am I able to use this data in my custom scripts without inhereting from SerializedBehaviour or writing my custom inspector?
If you're enjoying my products, updates and support, please consider supporting me on patreon.com!