Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
99f8234
Update InputSettingsProvider.cs
josepmariapujol-unity Mar 18, 2026
6f1a539
Update InputSettingsProvider.cs
josepmariapujol-unity Mar 18, 2026
2a79a26
spacing
josepmariapujol-unity Mar 18, 2026
4433681
iOS seetings commit
josepmariapujol-unity Mar 18, 2026
10b3868
Editor commit
josepmariapujol-unity Mar 18, 2026
99389b3
Improved Shortcut Support commit
josepmariapujol-unity Mar 18, 2026
aea0206
m_SupportedDevicesHelpBox commit
josepmariapujol-unity Mar 18, 2026
f7697e8
Moving SupportedDevicesHelpBox to the right place
josepmariapujol-unity Mar 18, 2026
e566ab2
Moving Supported devices right position
josepmariapujol-unity Mar 18, 2026
beee502
Formatting
josepmariapujol-unity Mar 18, 2026
d848d7d
Removing TODO
josepmariapujol-unity Mar 18, 2026
5694036
Removing redundant conditional statements
josepmariapujol-unity Mar 18, 2026
3090e30
Merge branch 'develop' into input/settings-uitoolkit-josep
josepmariapujol-unity Mar 19, 2026
635cc51
Converting button Create settings asset to UIToolkit
josepmariapujol-unity Mar 19, 2026
bdf47cb
Update InputSettingsProvider.cs
josepmariapujol-unity Mar 19, 2026
1622c06
Removing old legacy imgui
josepmariapujol-unity Mar 20, 2026
4d955d5
Supported devices list to UIToolkit
josepmariapujol-unity Mar 20, 2026
e882c7a
Title Supported Devices and common container
josepmariapujol-unity Mar 20, 2026
1ec0750
Removed UnityEditorInternal since no use of IMGUI
josepmariapujol-unity Mar 21, 2026
6ac5b71
Merge branch 'develop' into input/settings-uitoolkit-josep
josepmariapujol-unity May 6, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,34 +1,103 @@
#if UNITY_EDITOR
using System;
using UnityEditor;
using UnityEngine.UIElements;

namespace UnityEngine.InputSystem
{
internal class InputSettingsiOSProvider
{
[NonSerialized] private SerializedProperty m_MotionUsageEnabled;
[NonSerialized] private SerializedProperty m_MotionUsageDescription;
[NonSerialized] private VisualElement m_Container;
[NonSerialized] private Toggle m_MotionUsageToggle;
[NonSerialized] private TextField m_MotionUsageDescriptionField;

private GUIContent m_MotionUsageContent;
private GUIContent m_MotionUsageDescriptionContent;

public InputSettingsiOSProvider(SerializedObject parent)
{
var prefix = "m_iOSSettings.m_MotionUsage";
m_MotionUsageEnabled = parent.FindProperty(prefix + ".m_Enabled");
m_MotionUsageDescription = parent.FindProperty(prefix + ".m_Description");
Update(parent);

m_MotionUsageContent = new GUIContent("Motion Usage", "Enables Motion Usage for the app, required for sensors like Step Counter. This also adds 'Privacy - Motion Usage Description' entry to Info.plist");
m_MotionUsageDescriptionContent = new GUIContent(" Description", "Describe why the app wants to access the device's Motion Usage sensor.");
}

public void Update(SerializedObject parent)
{
var prefix = "m_iOSSettings.m_MotionUsage";
m_MotionUsageEnabled = parent.FindProperty(prefix + ".m_Enabled");
m_MotionUsageDescription = parent.FindProperty(prefix + ".m_Description");
}

public void OnGUI()
{
EditorGUILayout.PropertyField(m_MotionUsageEnabled, m_MotionUsageContent);
EditorGUI.BeginDisabledGroup(!m_MotionUsageEnabled.boolValue);
EditorGUILayout.PropertyField(m_MotionUsageDescription, m_MotionUsageDescriptionContent);
EditorGUI.EndDisabledGroup();
}

public void CreateGUI(VisualElement parent, Action onValueChanged)
{
if (parent == null)
return;

m_Container = new VisualElement();
var titleLabel = new Label("iOS");
titleLabel.style.unityFontStyleAndWeight = FontStyle.Bold;
titleLabel.style.marginTop = 12;
m_Container.Add(titleLabel);

m_MotionUsageToggle = new Toggle(m_MotionUsageContent.text)
{
tooltip = m_MotionUsageContent.tooltip
};
m_MotionUsageToggle.RegisterValueChangedCallback(evt =>
{
if (m_MotionUsageEnabled == null || m_MotionUsageEnabled.boolValue == evt.newValue)
return;

m_MotionUsageEnabled.boolValue = evt.newValue;
onValueChanged?.Invoke();
});
m_Container.Add(m_MotionUsageToggle);

m_MotionUsageDescriptionField = new TextField("Description")
{
tooltip = m_MotionUsageDescriptionContent.tooltip
};
m_MotionUsageDescriptionField.RegisterValueChangedCallback(evt =>
{
if (m_MotionUsageDescription == null || m_MotionUsageDescription.stringValue == evt.newValue)
return;

m_MotionUsageDescription.stringValue = evt.newValue;
onValueChanged?.Invoke();
});
m_Container.Add(m_MotionUsageDescriptionField);

parent.Add(m_Container);
}

public void RefreshUIToolkitState(bool canEditSettings)
{
if (m_Container == null)
return;

if (m_MotionUsageToggle != null)
{
m_MotionUsageToggle.SetEnabled(canEditSettings && m_MotionUsageEnabled != null);
m_MotionUsageToggle.SetValueWithoutNotify(m_MotionUsageEnabled?.boolValue ?? false);
}

if (m_MotionUsageDescriptionField != null)
{
m_MotionUsageDescriptionField.SetEnabled(canEditSettings && m_MotionUsageEnabled != null && m_MotionUsageEnabled.boolValue);
m_MotionUsageDescriptionField.SetValueWithoutNotify(m_MotionUsageDescription?.stringValue ?? string.Empty);
}
}
}
}
#endif
Loading
Loading