I’m getting this error, only occasionally, in my Console.
This is a pop-over window that I’m enabling, and in OnEnable(), I’m also setting the state of the Toggles on the screen. The Toggle is indeed part of the ToggleGroup, both before the game is Played, as well as seen in the Inspector, immediately after the error occurs. And, even though the Console claims the Toggle isn’t part of the group, once the window appears the Toggles all work as expected.
I suspect that this is a bit of a timing issue; that the window is almost Enabled, and that its children aren’t quite Enabled enough to be properly manipulated. This is based on another issue I’m seeing, where I attempt to Enable or Disable certain child objects on a different window’s OnEnable().
lilboylost - what does that code look like for you? I’m using the following script attached to a Toggle (assign the reference to ToggleGroup) and not getting any love:
using UnityEngine;
using UnityEngine.UI;
using System.Collections;
public class ToggleFix : MonoBehaviour
{
public ToggleGroup group;
void Start( )
{
Toggle toggle = GetComponentInChildren<Toggle>( );
toggle.group = group;
}
}
for now i’ll just use a custom solution with the toggles, seems webplayer related but i’m building out to webplayer atm for testing so i’d like it to work :).
I know this is an old post, but if someone finds it useful… I had the same error in Unity 2019.
The code was working properly up to Unity 2018, then started to fail when assigning the Toggle.group property.
The solution was to UnregisterToggle() before deleting its GameObject (Toggle included), then new items (with toggles) will let you set the Toggle.group properly.