您当前的位置: 首页 > 

Peter_Gao_

暂无认证

  • 0浏览

    0关注

    621博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文

Bug Error: Invalid SortingGroup index set in Renderer

Peter_Gao_ 发布时间:2021-08-18 10:53:11 ,浏览量:0

  SortingGroup[] sortingGroups;
  SortingGroup[] SortingGroups => sortingGroups ?? (sortingGroups = GetComponentsInChildren());
 
    void OnEnable()
    {
        foreach (SortingGroup sortingGroup in SortingGroups)
            sortingGroup.enabled = true;
    }
 
    void OnDisable()
    {
        foreach (SortingGroup sortingGroup in SortingGroups)
            sortingGroup.enabled = false;
    }
The script with the similar code should be attached to the root of pooled object. Hope, it will help you.

akianto, Jul 18, 2020

Still happening in 2020.1.10 ... looks like this is caused, for me, by creating an object from a pool and setting one of its children to active in the same frame. Happens very infrequently, added a sorting group to the parent object in an attempt to hack around this, will update if this doesn't work.

https://forum.unity.com/threads/invalid-sortinggroup-index-set-in-renderer.586450/#post-6462529

关注
打赏
1664521772
查看更多评论
立即登录/注册

微信扫码登录

0.0376s