/* Called when an asset is saved */
        public void OnAssetSaved(string name, object asset, out Dictionary <string, byte[]> userData)
        {
            Debug.Log("TMPE: OnAssetSaved");

            userData = null;

            if (!LoadingExtension.IsInAssetEditor)
            {
                return;
            }

            BuildingInfo info = asset as BuildingInfo;

            if (info == null)
            {
                return;
            }

            bool success = true;

            TmpeAssetData data = new TmpeAssetData();

            data.Segments = BuildingDecorationPatch.m_pendingSegments;
            Configuration config = SerializableDataExtension.CreateConfiguration(ref success);

            userData = new Dictionary <string, byte[]>();

            // ??? !!!
            SerializableDataExtension.OnBeforeGameSaved(ref success);
            data.TmpeConfiguration = SerializableDataExtension.Serialize(config, ref success);
            SerializableDataExtension.OnAfterGameSaved(ref success);

            if (!success)
            {
                return;
            }

            if (BuildingDecorationPatch.m_pendingSegments?.Count > 0)
            {
                userData.Add(SerializableDataExtension.DataId + segmentsString, SerializableDataExtension.Serialize <List <IdentificationTool.AssetSegment> >(data.Segments, ref success));
                userData.Add(SerializableDataExtension.DataId + dataString, data.TmpeConfiguration);
                AssetDataManager.Instance.AssetsWithData[IdentificationTool.GetNameWithoutPrefix(info.name)] = data;
            }
        }