Skip to content

Commit 683767b

Browse files
committed
Merge develop branch
2 parents 9dfc7a3 + e8abd1c commit 683767b

File tree

87 files changed

+21095
-1395
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

87 files changed

+21095
-1395
lines changed

.yamato/config.metadata

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ editors:
99
- version: 6000.2
1010
run_tvos: false
1111
- version: trunk
12+
run_ios_15: true
1213
run_tvos: false
1314

1415
utr_install_win: curl -s https://artifactory.prd.it.unity3d.com/artifactory/unity-tools-local/utr-standalone/utr.bat --output utr.bat
@@ -57,18 +58,18 @@ platforms_nix:
5758
installscript: unity-downloader-cli -c editor -c StandaloneSupport-IL2CPP --wait --fast -u
5859
- name: linux
5960
type: Unity::VM
60-
image: package-ci/ubuntu-20.04:v4
61+
image: package-ci/ubuntu-22.04:v4
6162
flavor: b1.large
6263
instabilities_run: sh ./run_standalone_instability_detection-latest.sh ubuntu 0.5.1 || exit 0
6364
- name: linux_standalone
6465
type: Unity::VM
65-
image: package-ci/ubuntu-20.04:v4
66+
image: package-ci/ubuntu-22.04:v4
6667
flavor: b1.large
6768
instabilities_run: sh ./run_standalone_instability_detection-latest.sh ubuntu 0.5.1 || exit 0
6869
runtime: StandaloneLinux64
6970
- name: linux_standalone_il2cpp
7071
type: Unity::VM
71-
image: package-ci/ubuntu-20.04:v4
72+
image: package-ci/ubuntu-22.04:v4
7273
flavor: b1.large
7374
instabilities_run: sh ./run_standalone_instability_detection-latest.sh ubuntu 0.5.1 || exit 0
7475
runtime: StandaloneLinux64

.yamato/upm-ci.yml

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
- move /Y .\Packages\com.unity.inputsystem\Samples .\Assets
3636
- move /Y .\Packages\com.unity.inputsystem\Samples.meta .\Assets
3737
# Now run our full test suite that sits in Assets/Tests by running UTR on our project.
38-
- UnifiedTestRunner --testproject . --timeout=1200 --editor-location=.Editor --artifacts_path=upm-ci~/test-results/isolation-com.unity.inputsystem.tests --suite=playmode {% if platform.name == "win" %} --suite=editor {% endif %} {% if category.name == "performance" %} --category=Performance {% else %} --category=!Performance {% endif %} --api-profile=NET_4_6 {% if platform.runtime %} --platform {{ platform.runtime }} {% endif %} {% if platform.scripting-backend %} --scripting-backend {{ platform.scripting-backend }} {% endif %} {% if category.name == "performance" %} --report-performance-data --performance-project-id=InputSystem {% endif %} {% if platform.name == "win" and category.name == "functional" %}--enable-code-coverage --coverage-options="generateAdditionalMetrics;generateHtmlReport;assemblyFilters:+Unity.InputSystem" --coverage-results-path={{ yamato_source_dir_win }}/upm-ci~/test-results/CodeCoverage/Project --coverage-upload-options="reportsDir:upm-ci~/test-results/CodeCoverage/Project;name:{{platform.name}}_{{editor.version}}_project;flags:{{platform.name}}_{{editor.version}}_project" {% endif %}
38+
- UnifiedTestRunner --testproject . --timeout=1200 --editor-location=.Editor --artifacts_path=upm-ci~/test-results/isolation-com.unity.inputsystem.tests --clean-library --reruncount=1 --clean-library-on-rerun --suite=playmode {% if platform.name == "win" %} --suite=editor {% endif %} {% if category.name == "performance" %} --category=Performance {% else %} --category=!Performance {% endif %} --api-profile=NET_4_6 {% if platform.runtime %} --platform {{ platform.runtime }} {% endif %} {% if platform.scripting-backend %} --scripting-backend {{ platform.scripting-backend }} {% endif %} {% if category.name == "performance" %} --report-performance-data --performance-project-id=InputSystem {% endif %} {% if platform.name == "win" and category.name == "functional" %}--enable-code-coverage --coverage-options="generateAdditionalMetrics;generateHtmlReport;assemblyFilters:+Unity.InputSystem" --coverage-results-path={{ yamato_source_dir_win }}/upm-ci~/test-results/CodeCoverage/Project --coverage-upload-options="reportsDir:upm-ci~/test-results/CodeCoverage/Project;name:{{platform.name}}_{{editor.version}}_project;flags:{{platform.name}}_{{editor.version}}_project" {% endif %}
3939
{% if platform.name == "win" and category.name == "functional" %}
4040
# Delete the Package and Project reports & raw coverage data, to keep Artifacts.zip smaller
4141
- rmdir /s/q "{{ yamato_source_dir_win }}/upm-ci~/test-results/CodeCoverage/Package"
@@ -87,7 +87,7 @@
8787
- mv ./Packages/com.unity.inputsystem/Samples ./Assets
8888
- mv ./Packages/com.unity.inputsystem/Samples.meta ./Assets
8989
# Now run our full test suite that sits in Assets/Tests by running UTR on our project.
90-
- UnifiedTestRunner --testproject . --timeout=1200 --editor-location=.Editor --artifacts_path=upm-ci~/test-results/isolation-com.unity.inputsystem.tests --suite=playmode {% if platform.name == "mac" or platform.name == "linux"%} --suite=editor {% endif %} {% if category.name == "performance" %} --category=Performance {% else %} --category=!Performance {% endif %} --api-profile=NET_4_6 {% if platform.runtime %} --platform {{ platform.runtime }} {% endif %} {% if platform.scripting-backend %} --scripting-backend {{ platform.scripting-backend }} {% endif %} {% if category.name == "performance" %} --report-performance-data --performance-project-id=InputSystem {% endif %} {% if category.name == "functional" and platform.name == "mac" or platform.name == "linux" %} --enable-code-coverage --coverage-options="generateAdditionalMetrics;generateHtmlReport;assemblyFilters:+Unity.InputSystem" --coverage-results-path={{ yamato_source_dir_nix }}/upm-ci~/test-results/CodeCoverage/Project --coverage-upload-options="reportsDir:upm-ci~/test-results/CodeCoverage/Project;name:{{platform.name}}_{{editor.version}}_project;flags:{{platform.name}}_{{editor.version}}_project" {% endif %}
90+
- UnifiedTestRunner --testproject . --timeout=1200 --editor-location=.Editor --artifacts_path=upm-ci~/test-results/isolation-com.unity.inputsystem.tests --clean-library --reruncount=1 --clean-library-on-rerun --suite=playmode {% if platform.name == "mac" or platform.name == "linux"%} --suite=editor {% endif %} {% if category.name == "performance" %} --category=Performance {% else %} --category=!Performance {% endif %} --api-profile=NET_4_6 {% if platform.runtime %} --platform {{ platform.runtime }} {% endif %} {% if platform.scripting-backend %} --scripting-backend {{ platform.scripting-backend }} {% endif %} {% if category.name == "performance" %} --report-performance-data --performance-project-id=InputSystem {% endif %} {% if category.name == "functional" and platform.name == "mac" or platform.name == "linux" %} --enable-code-coverage --coverage-options="generateAdditionalMetrics;generateHtmlReport;assemblyFilters:+Unity.InputSystem" --coverage-results-path={{ yamato_source_dir_nix }}/upm-ci~/test-results/CodeCoverage/Project --coverage-upload-options="reportsDir:upm-ci~/test-results/CodeCoverage/Project;name:{{platform.name}}_{{editor.version}}_project;flags:{{platform.name}}_{{editor.version}}_project" {% endif %}
9191
{% if category.name == "functional" and platform.name == "mac" or platform.name == "linux"%}
9292
# Delete the Package and Project reports & raw coverage data, to keep Artifacts.zip smaller
9393
- rm -rf {{ yamato_source_dir_nix }}/upm-ci~/test-results/CodeCoverage/Package
@@ -120,9 +120,12 @@ build_ios_{{ editor.version }}_{{ category.name }}:
120120
variables:
121121
EDITOR_VERSION: {{ editor.version }}
122122
UTR_VERSION: 1.35.1
123+
{% if editor.run_ios_15 %}
124+
UNITY_HANDLEUIINTERRUPTIONS: 1
125+
{% endif %}
123126
commands:
124127
- unity-downloader-cli -c Editor -c iOS -u $EDITOR_VERSION --fast --wait
125-
- UnifiedTestRunner --suite=playmode {% if category.name == "performance" %} --category=Performance {% else %} --category=!Performance {% endif %} --platform=iOS --editor-location=.Editor --testproject=. --player-save-path=build/players --artifacts_path=build/logs --build-only {% if category.name == "performance" %} --report-performance-data --performance-project-id=InputSystem {% endif %}
128+
- UnifiedTestRunner --suite=playmode --clean-library --reruncount=1 --clean-library-on-rerun {% if category.name == "performance" %} --category=Performance {% else %} --category=!Performance {% endif %} --platform=iOS --editor-location=.Editor --testproject=. --player-save-path=build/players --artifacts_path=build/logs --build-only {% if category.name == "performance" %} --report-performance-data --performance-project-id=InputSystem {% endif %}
126129
after:
127130
- {{ instabilities_install_nix }}
128131
- {{ instabilities_run_mac }}
@@ -139,7 +142,11 @@ run_ios_{{ editor.version }}_{{ category.name }}:
139142
agent:
140143
type: Unity::mobile::iPhone
141144
image: {{ ios_and_tvos_macos_bokken_image }}
145+
{% if editor.run_ios_15 %}
146+
model: SE-Gen3
147+
{% else %}
142148
model: SE
149+
{% endif %}
143150
flavor: b1.medium
144151
variables:
145152
EDITOR_VERSION: {{ editor.version }}
@@ -149,7 +156,7 @@ run_ios_{{ editor.version }}_{{ category.name }}:
149156
dependencies:
150157
- .yamato/upm-ci.yml#build_ios_{{ editor.version }}_{{ category.name }}
151158
commands:
152-
- UnifiedTestRunner --suite=playmode {% if category.name == "performance" %} --category=Performance {% else %} --category=!Performance {% endif %} --platform=iOS --player-load-path=build/players --artifacts_path=build/test-results {% if category.name == "performance" %} --report-performance-data --performance-project-id=InputSystem {% endif %}
159+
- UnifiedTestRunner --suite=playmode --clean-library --reruncount=1 --clean-library-on-rerun {% if category.name == "performance" %} --category=Performance {% else %} --category=!Performance {% endif %} --platform=iOS --player-load-path=build/players --artifacts_path=build/test-results {% if category.name == "performance" %} --report-performance-data --performance-project-id=InputSystem {% endif %}
153160
after:
154161
- {{ instabilities_install_nix }}
155162
- {{ instabilities_run_mac }}
@@ -169,7 +176,7 @@ build_tvos_{{ editor.version }}_{{ category.name }}:
169176
UTR_VERSION: 1.35.1
170177
commands:
171178
- unity-downloader-cli -c Editor -c AppleTV -u $EDITOR_VERSION --fast --wait
172-
- UnifiedTestRunner --suite=playmode {% if category.name == "performance" %} --category=Performance {% else %} --category=!Performance {% endif %} --platform=tvOS --editor-location=.Editor --testproject=. --player-save-path=build/players --artifacts_path=build/logs --build-only {% if category.name == "performance" %} --report-performance-data --performance-project-id=InputSystem {% endif %}
179+
- UnifiedTestRunner --suite=playmode --clean-library --reruncount=1 --clean-library-on-rerun {% if category.name == "performance" %} --category=Performance {% else %} --category=!Performance {% endif %} --platform=tvOS --editor-location=.Editor --testproject=. --player-save-path=build/players --artifacts_path=build/logs --build-only {% if category.name == "performance" %} --report-performance-data --performance-project-id=InputSystem {% endif %}
173180
after:
174181
- {{ instabilities_install_nix }}
175182
- {{ instabilities_run_mac }}
@@ -195,7 +202,7 @@ run_tvos_{{ editor.version }}_{{ category.name }}:
195202
dependencies:
196203
- .yamato/upm-ci.yml#build_tvos_{{ editor.version }}_{{ category.name }}
197204
commands:
198-
- UnifiedTestRunner --suite=playmode {% if category.name == "performance" %} --category=Performance {% else %} --category=!Performance {% endif %} --platform=tvOS --player-load-path=build/players --artifacts_path=build/test-results {% if category.name == "performance" %} --report-performance-data --performance-project-id=InputSystem {% endif %}
205+
- UnifiedTestRunner --suite=playmode --clean-library --reruncount=1 --clean-library-on-rerun {% if category.name == "performance" %} --category=Performance {% else %} --category=!Performance {% endif %} --platform=tvOS --player-load-path=build/players --artifacts_path=build/test-results {% if category.name == "performance" %} --report-performance-data --performance-project-id=InputSystem {% endif %}
199206
after:
200207
- {{ instabilities_install_nix }}
201208
- {{ instabilities_run_mac }}
@@ -217,7 +224,7 @@ build_android_{{ editor.version }}_{{ backend.name }}_{{ category.name }}:
217224
EDITOR_VERSION: {{ editor.version }}
218225
commands:
219226
- unity-downloader-cli -c Editor -c Android -u %EDITOR_VERSION% --fast --wait
220-
- UnifiedTestRunner --suite=playmode {% if category.name == "performance" %} --category=Performance {% else %} --category=!Performance {% endif %} --platform=Android --editor-location=.Editor --testproject=. --player-save-path=build/players --artifacts_path=build/logs --scripting-backend={{ backend.name }} --build-only --repository {% if category.name == "performance" %} --performance-project-id=InputSystem {% endif %}
227+
- UnifiedTestRunner --suite=playmode --clean-library --reruncount=1 --clean-library-on-rerun {% if category.name == "performance" %} --category=Performance {% else %} --category=!Performance {% endif %} --platform=Android --editor-location=.Editor --testproject=. --player-save-path=build/players --artifacts_path=build/logs --scripting-backend={{ backend.name }} --build-only --repository {% if category.name == "performance" %} --performance-project-id=InputSystem {% endif %}
221228
after:
222229
- {{ instabilities_install_win }}
223230
- {{ instabilities_run_win }}
@@ -250,7 +257,7 @@ run_android_{{ editor.version }}_{{ backend.name }}_{{ category.name }}:
250257
start %ANDROID_SDK_ROOT%\platform-tools\adb.exe connect %BOKKEN_DEVICE_IP%
251258
# List the connected devices
252259
start %ANDROID_SDK_ROOT%\platform-tools\adb.exe devices
253-
UnifiedTestRunner --suite=playmode {% if category.name == "performance" %} --category=Performance {% else %} --category=!Performance {% endif %} --platform=android --player-load-path=build/players --artifacts_path=build/test-results {% if category.name == "performance" %} --report-performance-data --performance-project-id=InputSystem {% endif %}
260+
UnifiedTestRunner --suite=playmode --clean-library --reruncount=1 --clean-library-on-rerun {% if category.name == "performance" %} --category=Performance {% else %} --category=!Performance {% endif %} --platform=android --player-load-path=build/players --artifacts_path=build/test-results {% if category.name == "performance" %} --report-performance-data --performance-project-id=InputSystem {% endif %}
254261
after:
255262
- start %ANDROID_SDK_ROOT%\platform-tools\adb.exe connect %BOKKEN_DEVICE_IP%
256263
- if not exist build\test-results mkdir build\test-results
Lines changed: 161 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,161 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using UnityEngine.Events;
4+
using UnityEngine.UI;
5+
6+
namespace UnityEngine.InputSystem.Samples.RebindUI
7+
{
8+
public class ActionLabel : MonoBehaviour
9+
{
10+
[Tooltip("Reference to action that is to be rebound from the UI.")]
11+
[SerializeField]
12+
private InputActionReference m_Action;
13+
14+
[SerializeField]
15+
private string m_BindingId;
16+
17+
[SerializeField]
18+
private InputBinding.DisplayStringOptions m_DisplayStringOptions;
19+
20+
[Tooltip("Text label that will receive the current, formatted binding string.")]
21+
[SerializeField]
22+
private Text m_BindingText;
23+
24+
[Tooltip("Event that is triggered when the way the binding is display should be updated. This allows displaying "
25+
+ "bindings in custom ways, e.g. using images instead of text.")]
26+
[SerializeField]
27+
private UpdateBindingUIEvent m_UpdateBindingUIEvent;
28+
29+
private static List<ActionLabel> s_InputActionUIs;
30+
31+
/// <summary>
32+
/// Reference to the action that is to be rebound.
33+
/// </summary>
34+
public InputActionReference actionReference
35+
{
36+
get => m_Action;
37+
set
38+
{
39+
m_Action = value;
40+
UpdateBindingDisplay();
41+
}
42+
}
43+
44+
/// <summary>
45+
/// ID (in string form) of the binding that is to be rebound on the action.
46+
/// </summary>
47+
/// <seealso cref="InputBinding.id"/>
48+
public string bindingId
49+
{
50+
get => m_BindingId;
51+
set
52+
{
53+
m_BindingId = value;
54+
UpdateBindingDisplay();
55+
}
56+
}
57+
58+
/// <summary>
59+
/// Text component that receives the display string of the binding. Can be <c>null</c> in which
60+
/// case the component entirely relies on <see cref="updateBindingUIEvent"/>.
61+
/// </summary>
62+
public Text bindingText
63+
{
64+
get => m_BindingText;
65+
set
66+
{
67+
m_BindingText = value;
68+
UpdateBindingDisplay();
69+
}
70+
}
71+
72+
/// <summary>
73+
/// Display options for the binding.
74+
/// </summary>
75+
public InputBinding.DisplayStringOptions displayStringOptions
76+
{
77+
get => m_DisplayStringOptions;
78+
set
79+
{
80+
m_DisplayStringOptions = value;
81+
UpdateBindingDisplay();
82+
}
83+
}
84+
85+
/// <summary>
86+
/// Trigger a refresh of the currently displayed binding.
87+
/// </summary>
88+
public void UpdateBindingDisplay()
89+
{
90+
var displayString = string.Empty;
91+
var deviceLayoutName = default(string);
92+
var controlPath = default(string);
93+
94+
// Get display string from action.
95+
var action = m_Action?.action;
96+
if (action != null)
97+
{
98+
var bindingIndex = action.bindings.IndexOf(x => x.id.ToString() == m_BindingId);
99+
if (bindingIndex != -1)
100+
displayString = action.GetBindingDisplayString(bindingIndex, out deviceLayoutName, out controlPath, displayStringOptions);
101+
}
102+
103+
// Set on label (if any).
104+
if (m_BindingText != null)
105+
m_BindingText.text = displayString;
106+
107+
// Give listeners a chance to configure UI in response.
108+
m_UpdateBindingUIEvent?.Invoke(this, displayString, deviceLayoutName, controlPath);
109+
}
110+
111+
protected void OnEnable()
112+
{
113+
if (s_InputActionUIs == null)
114+
s_InputActionUIs = new List<ActionLabel>();
115+
s_InputActionUIs.Add(this);
116+
if (s_InputActionUIs.Count == 1)
117+
InputSystem.onActionChange += OnActionChange;
118+
UpdateBindingDisplay();
119+
}
120+
121+
protected void OnDisable()
122+
{
123+
s_InputActionUIs.Remove(this);
124+
if (s_InputActionUIs.Count == 0)
125+
{
126+
s_InputActionUIs = null;
127+
InputSystem.onActionChange -= OnActionChange;
128+
}
129+
}
130+
131+
// When the action system re-resolves bindings, we want to update our UI in response
132+
// to show the currently relevant binding.
133+
private static void OnActionChange(object obj, InputActionChange change)
134+
{
135+
if (change != InputActionChange.BoundControlsChanged)
136+
return;
137+
138+
var action = obj as InputAction;
139+
var actionMap = action?.actionMap ?? obj as InputActionMap;
140+
var actionAsset = actionMap?.asset ?? obj as InputActionAsset;
141+
142+
for (var i = 0; i < s_InputActionUIs.Count; ++i)
143+
{
144+
var component = s_InputActionUIs[i];
145+
var referencedAction = component.actionReference?.action;
146+
if (referencedAction == null)
147+
continue;
148+
149+
if (referencedAction == action ||
150+
referencedAction.actionMap == actionMap ||
151+
referencedAction.actionMap?.asset == actionAsset)
152+
component.UpdateBindingDisplay();
153+
}
154+
}
155+
}
156+
157+
[Serializable]
158+
public class UpdateBindingUIEvent : UnityEvent<ActionLabel, string, string, string>
159+
{
160+
}
161+
}

Assets/Samples/RebindingUI/ActionLabel.cs.meta

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)