public override void OnImportAsset(AssetImportContext ctx)
        {
            var syncMaterial = PlayerFile.Load <SyncMaterial>(ctx.assetPath);

            Init(syncMaterial.Name);

            var syncedData = new SyncedData <SyncMaterial>(StreamKey.FromSyncId <SyncMaterial>(EditorSourceId, syncMaterial.Id), syncMaterial);

            var materialImporter = new SyncMaterialImporter();
            var material         = materialImporter.Import(syncedData, this);

            material.name = Path.GetFileNameWithoutExtension(syncMaterial.Name);

            ctx.AddObjectToAsset("material", material);

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

            ctx.AddObjectToAsset("root", root, AssetPreview.GetMiniThumbnail(material));
            ctx.SetMainObject(root);
        }
예제 #2
0
 protected override Material Import(SyncedData <SyncMaterial> syncMaterial)
 {
     return(m_Importer.Import(syncMaterial, m_TextureCache));
 }