I'd like to serialize a Resource so that I can send it over a network in a networked game. That is, I'd like to take an instance of a custom class I've created, turn it into a PackedByteArray or a String or something like that, send it to the server with an RPC call and have the server decode it back into the original resource. Both the client and the server have scripts defining my resource object.
Godot does have a ResourceSaver, but this only writes to a file, not to a PackedByteArray. I've tried writing custom functions that produce a Dictionary, but this is both cumbersome and there is no clean way to decide what class has been sent when the server receives it. Is there some way to do in memory serialization for Resource extending objects?