1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Unityで"UnityException: GetName can only be called from the main thread."というエラーが出た

Posted at

はじめに

UnityHubに共有されているスプライトを使用してゲームを作成していたところ、なぜかいろんなエラーが表示されて怖かったので共有します。

事象

Unityエラー.png

スプライトをタイルマップで表示する処理を実行したところ上記のようにerrorとwarningが出ました。
スクリプトのアタッチや変数の値には特に問題はなく、AIに聞いても解決する手順は教えてくれませんでした。(最近AIに依存してるのでAIに聞いて解決できないと絶望するんですよね)

Unityエラー2.png

タイルマップや変数を入れる欄が何も表示されなくなってます。気味が悪いですね。

解決策

Edit > Preferences > General > Editor Font へ進み
Inter(Default) → System Fontに変更する

自分はこれでエラーが表示されなくなりました。

おわりに

Unity6以降で実行した際に起きているという情報を耳にしたので、おそらくそこら辺が一因なのかなと思ってますが正確にはわかりませんでした。

Unity6関連の似たようなことが今後も起きるかもしれないので何かあったらまた書こうと思います。

今回の事象の参考↓
https://issuetracker.unity3d.com/issues/unityexception-getname-can-only-be-called-from-the-main-thread-dot-erors-are-thrown-when-the-shortcuts-window-is-opened-and-entering-play-mode-with-a-shortcut

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?