Please split the interface ISerializationCallbackReceiver into two separate interfaces ISerializationOnBeforeReceiver and ISerializationOnAfterReceiver.
The reason behind this is simple. Often, as a developer, you only need to react to one of the two callbacks in your component, but the interface forces you to implement both, leaving one method completely empty.
One example is the transformation of serializable objects into objects that are not supported by the serialization system of Unity. One might want to transform these objects with no intention of changes being propagated back, which is especially true for runtime, aiming to change the representation of an object into a more fitting object to optimize certain scenarios.
Splitting the interface into two ones could provide a performance boost after optimization, similar to how Unity encourages that empty Update()
and Start()
should be removed because they drain performance even if they do nothing.
You would probably end up with something like, allowing the change to be backwardly compatible:
public interface ISerializationCallbackReceiver : ISerializationOnBeforeReceiver, ISerializationOnAfterReceiver