{"author_url":"https://blog.hatena.ne.jp/baba_s/","url":"https://baba-s.hatenablog.com/entry/2023/01/02/000000","provider_url":"https://hatena.blog","blog_url":"https://baba-s.hatenablog.com/","categories":["Unity","Unity - \u30c8\u30e9\u30d6\u30eb\u30b7\u30e5\u30fc\u30c6\u30a3\u30f3\u30b0"],"title":"\u3010Unity\u3011UnityException: XXXX is not allowed to be called from a MonoBehaviour constructor","height":"190","author_name":"baba_s","published":"2023-01-02 00:00:00","version":"1.0","type":"rich","html":"<iframe src=\"https://hatenablog-parts.com/embed?url=https%3A%2F%2Fbaba-s.hatenablog.com%2Fentry%2F2023%2F01%2F02%2F000000\" title=\"\u3010Unity\u3011UnityException: XXXX is not allowed to be called from a MonoBehaviour constructor - \u30b3\u30ac\u30cd\u30d6\u30ed\u30b0\" class=\"embed-card embed-blogcard\" scrolling=\"no\" frameborder=\"0\" style=\"display: block; width: 100%; height: 190px; max-width: 500px; margin: 10px 0px;\"></iframe>","image_url":null,"width":"100%","provider_name":"Hatena Blog","blog_title":"\u30b3\u30ac\u30cd\u30d6\u30ed\u30b0","description":"\u6982\u8981 UnityException: XXXX is not allowed to be called from a MonoBehaviour constructor (or instance field initializer), call it in Awake or Start instead. Called from MonoBehaviour 'YYYY'. \u4e0a\u8a18\u306e\u3088\u3046\u306a\u30a8\u30e9\u30fc\u304c\u767a\u751f\u3057\u305f\u5834\u5408\u306f using UnityEngine; public class Example : MonoBehaviour { // \u3053\u3053\u3067\u30a8\u30e9\u30fc public Material m_material \u2026"}