Level should be assets, prefab as well, not be composed of an asset. The way assets are saved and loaded complexifies serialisation.
We should have an interface IRadAsset :
interface IRadAsset {
function serialize() : Dynamic;
function deSerialize(object : Dynamic) : IRadAsset;
function save(path : String) : Void;
function load(path : String) : IRadAsset;
function getPath() : String;
}
Something like this. When saved, the RadAsset stringify its field with json and save it
If a component containing an RadAsset field is stringified, it use the serialize method of that asset to replace it in the json.
On load it use the deSerialize method to create the instance.
Level should be assets, prefab as well, not be composed of an asset. The way assets are saved and loaded complexifies serialisation.
We should have an interface IRadAsset :
Something like this. When saved, the RadAsset stringify its field with json and save it If a component containing an RadAsset field is stringified, it use the serialize method of that asset to replace it in the json. On load it use the deSerialize method to create the instance.