Skip to content

Commit

Permalink
Merge pull request #458 from Unity-UI-Extensions/feature/2023testing
Browse files Browse the repository at this point in the history
Feature/2023testing
  • Loading branch information
SimonDarksideJ authored Nov 23, 2023
2 parents 54d9513 + 162e4d3 commit 0b8f1a0
Show file tree
Hide file tree
Showing 8 changed files with 57 additions and 9 deletions.
20 changes: 16 additions & 4 deletions .github/workflows/rununitybuildmultiversion.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,17 +52,29 @@ jobs:
unityVersion: 2021.3
build-target: WSAPlayer
- os: windows
unityVersion: 2022.2
unityVersion: 2022.3
build-target: Android
- os: macOS
unityVersion: 2022.2
unityVersion: 2022.3
build-target: iOS
- os: windows
unityVersion: 2022.2
unityVersion: 2022.3
build-target: StandaloneWindows64
- os: windows
unityVersion: 2022.2
unityVersion: 2022.3
build-target: WSAPlayer
- os: windows
unityVersion: 2023.1
build-target: Android
- os: macOS
unityVersion: 2023.1
build-target: iOS
- os: windows
unityVersion: 2023.1
build-target: StandaloneWindows64
- os: windows
unityVersion: 2023.1
build-target: WSAPlayer
steps:
- name: Script Version
run: |
Expand Down
4 changes: 4 additions & 0 deletions Editor/CanvasGroupActivator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,11 @@ void OnFocus()

void ObtainCanvasGroups()
{
#if UNITY_2023_1_OR_NEWER
canvasGroups = GameObject.FindObjectsByType<CanvasGroup>(FindObjectsSortMode.None);
#else
canvasGroups = GameObject.FindObjectsOfType<CanvasGroup>();
#endif
}

void OnGUI()
Expand Down
16 changes: 14 additions & 2 deletions Editor/UIExtensionsMenuOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,11 @@ private static void CreateEventSystem(bool select)

private static void CreateEventSystem(bool select, GameObject parent)
{
#if UNITY_2023_1_OR_NEWER
var esys = Object.FindFirstObjectByType<EventSystem>();
#else
var esys = Object.FindObjectOfType<EventSystem>();
#endif
if (esys == null)
{
var eventSystem = new GameObject("EventSystem");
Expand Down Expand Up @@ -191,7 +195,11 @@ static public GameObject GetOrCreateCanvasGameObject()
return canvas.gameObject;

// No canvas in selection or its parents? Then use just any canvas..
#if UNITY_2023_1_OR_NEWER
canvas = Object.FindFirstObjectByType<Canvas>();
#else
canvas = Object.FindObjectOfType(typeof(Canvas)) as Canvas;
#endif
if (canvas != null && canvas.gameObject.activeInHierarchy)
return canvas.gameObject;

Expand Down Expand Up @@ -1121,7 +1129,7 @@ static public void AddDropDownList(MenuCommand menuCommand)
mainButtonRT.anchorMin = Vector2.zero;
mainButtonRT.anchorMax = Vector2.one;
mainButtonRT.sizeDelta = Vector2.zero;
Events.UnityEventTools.AddBoolPersistentListener(mainButton.GetComponent<Button>().onClick, new UnityEngine.Events.UnityAction<bool>(dropDownList.ToggleDropdownPanel), true);
Events.UnityEventTools.AddPersistentListener(mainButton.GetComponent<Button>().onClick, dropDownList.ToggleDropdownPanel);
var mainButtonText = mainButton.GetComponentInChildren<Text>();
mainButtonText.alignment = TextAnchor.MiddleLeft;
mainButtonText.text = "Select Item...";
Expand Down Expand Up @@ -1149,7 +1157,7 @@ static public void AddDropDownList(MenuCommand menuCommand)
overlayRT.sizeDelta = new Vector2(0f, 1f);
overlayRT.pivot = new Vector2(0f, 1f);
overlay.AddComponent<Image>().color = new Color(0.243f, 0.871f, 0f, 0f);
Events.UnityEventTools.AddBoolPersistentListener(overlay.AddComponent<Button>().onClick, new UnityEngine.Events.UnityAction<bool>(dropDownList.ToggleDropdownPanel), true);
Events.UnityEventTools.AddPersistentListener(overlay.AddComponent<Button>().onClick, dropDownList.ToggleDropdownPanel);
//Overlay Scroll Panel
var overlayScrollPanelRT = overlayScrollPanel.GetComponent<RectTransform>();
overlayScrollPanelRT.position += new Vector3(0, -cbbRT.sizeDelta.y, 0);
Expand Down Expand Up @@ -1257,7 +1265,11 @@ private static void CreateToolTipItem(bool select)

private static void CreateToolTipItem(bool select, GameObject parent)
{
#if UNITY_2023_1_OR_NEWER
var btti = Object.FindFirstObjectByType<BoundTooltipItem>();
#else
var btti = Object.FindObjectOfType<BoundTooltipItem>();
#endif
if (btti == null)
{
var boundTooltipItem = CreateUIObject("ToolTipItem", parent.GetComponentInParent<Canvas>().gameObject);
Expand Down
6 changes: 3 additions & 3 deletions Runtime/Scripts/Controls/ComboBox/DropDownList.cs
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ private bool Initialize()
/// <param name="index"></param>
public void SelectItemIndex(int index)
{
ToggleDropdownPanel(false);
ToggleDropdownPanel();
OnItemClicked(index);
}

Expand Down Expand Up @@ -351,7 +351,7 @@ private void OnItemClicked(int indx)
if (indx != _selectedIndex && OnSelectionChanged != null) OnSelectionChanged.Invoke(indx);

_selectedIndex = indx;
ToggleDropdownPanel(true);
ToggleDropdownPanel();
UpdateSelected();
}

Expand Down Expand Up @@ -471,7 +471,7 @@ public void HideDropDownPanel()
return;
}

ToggleDropdownPanel(false);
ToggleDropdownPanel();
}

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,11 @@ public class ReorderableListDebug : MonoBehaviour

void Awake()
{
#if UNITY_2023_1_OR_NEWER
foreach (var list in FindObjectsByType<ReorderableList>(FindObjectsSortMode.None))
#else
foreach (var list in FindObjectsOfType<ReorderableList>())
#endif
{
list.OnElementDropped.AddListener(ElementDropped);
}
Expand Down
4 changes: 4 additions & 0 deletions Runtime/Scripts/Controls/SelectionBox/SelectionBox.cs
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,11 @@ void BeginSelection(){

// If we do not have a group of selectables already set, we'll just loop through every object that's a monobehaviour, and look for selectable interfaces in them
if (selectableGroup == null) {
#if UNITY_2023_1_OR_NEWER
behavioursToGetSelectionsFrom = GameObject.FindObjectsByType<MonoBehaviour>(FindObjectsSortMode.None);
#else
behavioursToGetSelectionsFrom = GameObject.FindObjectsOfType<MonoBehaviour>();
#endif
} else {
behavioursToGetSelectionsFrom = selectableGroup;
}
Expand Down
6 changes: 6 additions & 0 deletions Runtime/Scripts/ToolTips/BoundTooltip/BoundTooltipItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,13 @@ public static BoundTooltipItem Instance
get
{
if (instance == null)
{
#if UNITY_2023_1_OR_NEWER
instance = GameObject.FindFirstObjectByType<BoundTooltipItem>();
#else
instance = GameObject.FindObjectOfType<BoundTooltipItem>();
#endif
}
return instance;
}
}
Expand Down
6 changes: 6 additions & 0 deletions Runtime/Scripts/ToolTips/ToolTip.cs
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,13 @@ public static ToolTip Instance
get
{
if (instance == null)
{
#if UNITY_2023_1_OR_NEWER
instance = FindFirstObjectByType<ToolTip>();
#else
instance = FindObjectOfType<ToolTip>();
#endif
}
return instance;
}
}
Expand Down

0 comments on commit 0b8f1a0

Please sign in to comment.