Bug Error: Invalid SortingGroup index set in Renderer
SortingGroup[] sortingGroups;
SortingGroup[] SortingGroups => sortingGroups ?? (sortingGroups = GetComponentsInChildren<SortingGroup>());
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.
,
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.