/// <summary> /// Sets a group to a page. If no page exists, then a page is created. /// </summary> /// <param name="groupName">The group to assign to a page.</param> /// <param name="pageName">The name of the page to assign the group to.</param> public void SetGroupPage(string groupName, string pageName) { DebugItemGroup group = GetItemGroup(groupName, false); DebugPage page = GetPage(pageName, true); if (group != null) { // Remove from old group (ie, "Miscellaneous Items") DebugPage oldPage = GetPage(pageName, false); if (oldPage != null) { oldPage.RemoveGroup(group); } // Add to the new group page.AddGroup(group); } }
/// <summary> /// Gets the group item or creates one if it does not exist. /// </summary> /// <param name="groupName">The name of the group.</param> /// <param name="allowCreate">If true will create a group if it does not exist. If fall it will return null if a group does not exist.</param> /// <returns>The group item or null if the group does not exist and allowCreate is false.</returns> private DebugItemGroup GetItemGroup(string groupName, bool allowCreate) { DebugItemGroup group = null; if (m_ItemGroups.ContainsKey(groupName)) { group = m_ItemGroups[groupName]; } else if (allowCreate) { group = Instantiate(DebugItemGroupPrefab) as DebugItemGroup; group.Title = groupName; m_ItemGroups[groupName] = group; // Set to the default page DebugPage page = GetPage("Miscellaneous Items", true); page.AddGroup(group); } return(group); }