public override void OnImportAsset(AssetImportContext ctx)
        {
            var syncTexture = PlayerFile.Load <SyncTexture>(ctx.assetPath);
            var syncedData  = new SyncedData <SyncTexture>(StreamKey.FromSyncId <SyncTexture>(ReflectScriptedImporter.EditorSourceId, syncTexture.Id), syncTexture);

            var textureImporter = new SyncTextureImporter();
            var texture         = textureImporter.Import(syncedData, null);

            texture.name = Path.GetFileNameWithoutExtension(syncTexture.Name);

            ctx.AddObjectToAsset("texture", texture);

            var root = ScriptableObject.CreateInstance <ReflectScriptableObject>();

            ctx.AddObjectToAsset("root", root, AssetPreview.GetMiniThumbnail(texture));
            ctx.SetMainObject(root);
        }
Пример #2
0
 protected override Texture2D Import(SyncedData <SyncTexture> syncTexture)
 {
     return(m_TextureImporter.Import(syncTexture, null));
 }