LoginSignup
3
0

More than 1 year has passed since last update.

【Unity】ScriptableObjectを作成した時「No script asset for クラス名. Check that the definition is in a file of the same name and that it compiles properly.」と警告が出てうまく作成できない

Posted at

こんにちは、ユーゴです。
今回は、ScriptableObjectを作成した時に発生した問題を紹介します。
原因は、超シンプルです。

想定読者

ScirptableObjectの生成の仕方はわかる人
Unity初心者〜

問題

ScirptableObjectを生成すると、「No script asset for LocalVariableData. Check that the definition is in a file of the same name and that it compiles properly.」という警告が出る。
スクリーンショット 2022-10-10 12.52.04.png
また、ScriptableObjectが検索から除外されたり、プログラムでNullReferenceなど正しい挙動をしない。
スクリーンショット 2022-10-10 12.56.44.png

原因&解決

超シンプル。ファイルのクラス名と、スクリプトのクラス名が一致してない。
スクリーンショット 2022-10-10 12.58.29.png
スクリーンショット 2022-10-10 12.58.39.png
ファイル名が「LoacalVariableData」になっている。圧倒的typo。
同じ名前にしましょう。

まとめ

いかがだったでしょうか。今回は、かなり初歩的なミスを紹介しました。これで小一時間悩んでいた方の手助けになれば幸いです。
このように、Unityの初歩的な解説から、エディタ拡張など上級者向けの内容も発信しています。

もし気に入っていただけましたら、評価・フォローの方よろしくお願いします。

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