void OnEnable()
    {
        mNames = CAINavEditorSettingsEditor.GetAvoidanceNames();

        if (mDisplay == null || mDisplay.Length != mNames.Length)
        {
            mDisplay = new bool[mNames.Length];
        }
    }
    void OnEnable()
    {
        AgentGroupSettings targ = (AgentGroupSettings)target;

        mNamesAsset = AgentGroupNamesEditor.GetGlobalAsset();

        string[] names = mNamesAsset.groupNames;

        // Make sure the names asset is initialized.
        if (names == null || names.Length != AgentGroupNames.MaxGroups)
        {
            names = new string[AgentGroupNames.MaxGroups];

            for (int i = 1; i < names.Length; i++)
            {
                names[i] = AgentGroupNames.Undefined;
            }

            names[0] = "Default";

            mNamesAsset.groupNames = names;

            EditorUtility.SetDirty(mNamesAsset);
        }

        // Make sure settings are defined for names.
        for (int i = 0; i < names.Length; i++)
        {
            if (names[i] == AgentGroupNames.Undefined || targ.GetGroupIndex((byte)i) >= 0)
            {
                continue;
            }

            targ.AddGroup((byte)i);

            EditorUtility.SetDirty(target);
        }

        // Initialize the show flags.

        if (mShowGroup == null || mShowGroup.Length != names.Length)
        {
            mShowGroup = new bool[names.Length];
        }

        mAvoidanceNames = CAINavEditorSettingsEditor.GetAvoidanceNames();

        mNewArea = NextUndefined();
    }