LoginSignup
0
0

Unity 6 で Cinemachine をインポートしたら could not be found になる方へ

Last updated at Posted at 2024-05-12

Unity 6 の Cinemachine はデフォルトでバージョンが 3 系みたいです。
そして 3 系は API の破壊的変更があります。
対応しましょう。

ステップ1

cf.

Namespaces have changed to be more consistent with Unity standards.

  • Cinemachine is now Unity.Cinemachine
  • Cinemachine.Editor is now Unity.Cinemachine.Editor
  • Cinemachine.Utility has been folded into Unity.Cinemachine.

以上のように API を書き換えたり、そのあとに書かれている色々なこと(必要に応じてコンポーネントを変えるとか、ツールで一括置き換えするとか)をします。

例:
image.png
※↑で一括アップグレードするときはバックアップ必須。

ステップ2

例えば、こんなアセットを入れてると「ステップ1」だけじゃコンパイルエラーが消えないかもしれません。
エラーが出ているスクリプトの置かれたフォルダを見に行って、asmdef(Assembly Definition)がないか探してください。

上記アセットの場合、Assets/Starter Assets/Editor にあります。

2024-05-12-20-43-17.png

ボタンで Assembly Definition References に新しく Unity.Cinemachine を追加し、ボタンで Missing Reference を削除してください。

2024-05-12-20-44-21.png

そのあと忘れずに当該 Assembly Definition のインスペクター上で Apply してください。

2024-05-12-20-32-34.png

最後に Assets/Refresh すれば多分解決します。

謝辞

This ended up being an easier fix than I expected. The problem ended up being that the developer that I'm working with had created an assembly file that I didn't know existed. So I just had to add Cinemachine to that assembly file in the scripts folder.

状況は違うけど同じ仕組みでエラーが出ていた事例。asmdef は盲点だった。ありがとうございます。

0
0
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
0
0