4
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

Unity で GLB/GLTF Scripted Importer が被ってエラーになったら、

Last updated at Posted at 2023-02-28

こうじゃ。

UniVRM と Ready Player Me Unity SDK Core をインポートしたら、コンソールに以下の表示があった。

Multiple scripted importers are targeting the extension 'gltf' and have all been rejected: GLTFast.Editor.GltfImporter (assembly: C:\■PROJECT DIRECTORY■\Library\ScriptAssemblies\glTFast.Editor.dll), UniGLTF.GltfScriptedImporter (assembly: C:\■PROJECT DIRECTORY■\Library\ScriptAssemblies\UniGLTF.Editor.dll)
UnityEditor.AssetImporters.ScriptedImporter:RegisterScriptedImporters ()

Multiple scripted importers are targeting the extension 'glb' and have all been rejected: GLTFast.Editor.GltfImporter (assembly: C:\■PROJECT DIRECTORY■\Library\ScriptAssemblies\glTFast.Editor.dll), UniGLTF.GlbScriptedImporter (assembly: C:\■PROJECT DIRECTORY■\Library\ScriptAssemblies\UniGLTF.Editor.dll)
UnityEditor.AssetImporters.ScriptedImporter:RegisterScriptedImporters ()

フォーラムで以下の回答が見つかった。

If you can edit one of these plugins' code in your project then you should be able to work around the issue easily.
Choose one of the importer that you don't want to be the default for gltf import, and change the [ScriptedImporter] attribute to make it an optional importer.

    // Default importer
    [ScriptedImporter(1, new [] {"gltf", "glb"})]
    // Optional importer
    [ScriptedImporter(1, null, new [] {"gltf", "glb"})]

From that point, selecting any gltf or glb asset in your project should show you a drop-down at the top of the inspector to let you change which importer you want to use on that asset.

競合しているので、どちらかがデフォルトではなくなるようにスクリプトを書きかえれば良いらしい。

とりあえず UniVRM に入ってる方をデフォルトにすることにした。
glb, gltf それぞれでプロジェクト内を検索し、それっぽいスクリプトを開く。

GLB:
image.png

GLTF:
image.png

すでにプラットフォーム依存コンパイル(#if ディレクティブ)として、UNIGLTF_DISABLE_DEFAULT_GLTF_IMPORTERUNIGLTF_DISABLE_DEFAULT_GLB_IMPORTER が使えることが分かった。

Project Settings > Player > Other Settings > Script Compilation > Scripting Define Symbols に、上記の項目を追加する。

ここに↓
image.png
こう↓
image.png

Apply を押下するとコンパイルが走り、問題が解決する。

追記 @ 2023-03-01

この作業はプラットフォームごとに設定が必要です。

4
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?