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
 public TextureConverter(EventHub hub, MemoryTracker memTracker, IOutput <SyncedData <Texture2D> > output) : base(hub, memTracker, output)
 {
     m_TextureImporter = new SyncTextureImporter();
 }