美文网首页
StrangeIOC: 在Start中初始化上下文报错Media

StrangeIOC: 在Start中初始化上下文报错Media

作者: RichMartin | 来源:发表于2018-10-27 13:38 被阅读30次
    void Start () {
        this.context = new Demo1ContextView (this);
    }

在Start中初始化上下文报错
MediationException: A view was added with no context. Views must be added into the hierarchy of their ContextView lest all hell break loose.
Solved Way
MediationException: A view was added with no context. - Solved by adding the context in Awake and not Start.

    void Awake () {
        this.context = new Demo1ContextView (this);
    }

相关文章

网友评论

      本文标题:StrangeIOC: 在Start中初始化上下文报错Media

      本文链接:https://www.haomeiwen.com/subject/wrkdtqtx.html