コード例 #1
0
        public override void OnImportAsset(AssetImportContext ctx)
        {
            var syncMesh   = PlayerFile.Load <SyncMesh>(ctx.assetPath);
            var syncedData = new SyncedData <SyncMesh>(StreamKey.FromSyncId <SyncMesh>(ReflectScriptedImporter.EditorSourceId, syncMesh.Id), syncMesh);

            var meshImporter = new SyncMeshImporter();
            var mesh         = meshImporter.Import(syncedData, null);

            if (m_GenerateLightmapUVs)
            {
                Unwrapping.GenerateSecondaryUVSet(mesh);
            }

            mesh.name = Path.GetFileNameWithoutExtension(syncMesh.Name);

            ctx.AddObjectToAsset("mesh", mesh);

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

            ctx.AddObjectToAsset("root", root, AssetPreview.GetMiniThumbnail(mesh));
            ctx.SetMainObject(root);
        }
コード例 #2
0
 public MeshConverter(EventHub hub, MemoryTracker memTracker, IOutput <SyncedData <Mesh> > output) : base(hub, memTracker, output)
 {
     m_MeshImporter = new SyncMeshImporter();
 }