Merge pull request #458 from Unity-UI-Extensions/feature/2023testing

Feature/2023testing
pull/459/head
Simon (Darkside) Jackson 2023-11-23 22:28:02 +00:00 committed by GitHub
commit 0b8f1a0555
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 57 additions and 9 deletions

View File

@ -52,16 +52,28 @@ 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

View File

@ -29,7 +29,11 @@ namespace UnityEngine.UI.Extensions
void ObtainCanvasGroups()
{
#if UNITY_2023_1_OR_NEWER
canvasGroups = GameObject.FindObjectsByType<CanvasGroup>(FindObjectsSortMode.None);
#else
canvasGroups = GameObject.FindObjectsOfType<CanvasGroup>();
#endif
}
void OnGUI()

View File

@ -159,7 +159,11 @@ namespace UnityEditor.UI
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");
@ -191,7 +195,11 @@ namespace UnityEditor.UI
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;
@ -1121,7 +1129,7 @@ namespace UnityEditor.UI
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...";
@ -1149,7 +1157,7 @@ namespace UnityEditor.UI
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);
@ -1257,7 +1265,11 @@ namespace UnityEditor.UI
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);

View File

@ -166,7 +166,7 @@ namespace UnityEngine.UI.Extensions
/// <param name="index"></param>
public void SelectItemIndex(int index)
{
ToggleDropdownPanel(false);
ToggleDropdownPanel();
OnItemClicked(index);
}
@ -351,7 +351,7 @@ namespace UnityEngine.UI.Extensions
if (indx != _selectedIndex && OnSelectionChanged != null) OnSelectionChanged.Invoke(indx);
_selectedIndex = indx;
ToggleDropdownPanel(true);
ToggleDropdownPanel();
UpdateSelected();
}
@ -471,7 +471,7 @@ namespace UnityEngine.UI.Extensions
return;
}
ToggleDropdownPanel(false);
ToggleDropdownPanel();
}
/// <summary>

View File

@ -13,7 +13,11 @@ namespace UnityEngine.UI.Extensions
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);
}

View File

@ -169,7 +169,11 @@ namespace UnityEngine.UI.Extensions
// 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;
}

View File

@ -46,7 +46,13 @@ namespace UnityEngine.UI.Extensions
get
{
if (instance == null)
{
#if UNITY_2023_1_OR_NEWER
instance = GameObject.FindFirstObjectByType<BoundTooltipItem>();
#else
instance = GameObject.FindObjectOfType<BoundTooltipItem>();
#endif
}
return instance;
}
}

View File

@ -92,7 +92,13 @@ namespace UnityEngine.UI.Extensions
get
{
if (instance == null)
{
#if UNITY_2023_1_OR_NEWER
instance = FindFirstObjectByType<ToolTip>();
#else
instance = FindObjectOfType<ToolTip>();
#endif
}
return instance;
}
}