Custom De/Serializing of Asset File without Altering Runtime De/Serialization

We have a custom asset type, “AnimSet”, that store references to sprites. We also have a sprite-labelling system set up to work around the weird way unity stores sprites: We have a custom “SpriteIndex” asset which keeps track of each sprite’s virtual label. Ideally, we’d like to just store the “label” of a sprite in our AnimSet files. That way, we can change which sprite has a specific label, and have the AnimSet object update automatically in the editor (or at least after re-importing the custom asset).

Initially, I was hoping that on de-serializing an AnimSet from its file, Unity could check the stored label, and then load the appropriate sprite into a matching sprite field in the AnimSet’s object file. However, if I implement and alter ISerializationCallbackReceiver’s OnBeforeSerialize and OnAfterDeserialize methods in my AnimSet, won’t this also change how it gets used in a scene? If I have an object that references this AnimSet in my scene, I don’t want it to serialize the sprite back to a label, and then to a sprite when loaded. More strictly, I don’t want to include my SpriteIndex asset in our build at all. It’s really only meant as a means of storing sprites as strings in files, it shouldn’t affect runtime at all. But I can’t figure out how to de/serialize my AnimSets one way when storing/loading from file, and another way when referenced in a scene at runtime.

I am very open to any suggestions. I am not completely locked into this design pattern, it’s just my best attempt so far. Ideally I’d like to use this method, but if there’s something major I’ve missed I’d love to know about that as well. I am only somewhat comfortable with how Unity handles its asset files. As an added bonus, if someone who knows more could confirm/deny that this system will mesh well Unity’s AssetBundles, that would be appreciated. This system might be used on mobile, or on systems where we’d rather be updating installs with bundles, rather than having the user re-download an updated build from scratch.

I can clarify anything about this that wasn’t clear as well.

OK, so I realize the above was a bit dense. To sum up:

Is there a way to store data in a file, but then modify that information before it ends up in a scene? (ie de/serialize it to/from its file one way, but de/serialize it as an Object in the scene another way?) Let’s say I have this class.

class Foo : ScriptableObject {
    public string bar;
    public string bar1000;

    public void SetBarCombos() {
        bar1000 = "";
        for (int i = 0; i < 1000; i++) {
            bar1000 += bar;
        }
    }
}

And let’s also assume I have some valid reason for doing this. I don’t want to store any value for bar1000 in my .asset file (let’s say it’s for space reasons), but when the scene starts, I want that value to be pre-computed. I’m fine computing it each time I start up the Unity Editor, but when I play the game (in editor or in a build), I want bar1000 to be set already. Basically, I need a different way to serialize to/from file, and to/from the game.

File on Hard Drive (only stores bar) → Asset in Editor (calculates and stores value for bar1000) → Object in Game (already contains value for bar1000)