From d6e6249765871f7ccb1acc1c55ba9e6acaf8d65f Mon Sep 17 00:00:00 2001 From: Kazuki Matsumoto <1132081+karasusan@users.noreply.github.com> Date: Fri, 4 Aug 2023 15:37:16 +0900 Subject: [PATCH] fix: Add tooltips for Render Streaming Settings in Project Settings Window (#937) --- .../Editor/PropertyDrawers/SignalingSettingsDrawer.cs | 4 +++- .../Editor/RenderStreamingProjectSettingsProvider.cs | 8 ++++++-- .../Editor/SignalingManagerEditor.cs | 1 + .../Runtime/Scripts/RenderStreamingSettings.cs | 3 ++- .../Runtime/Scripts/Signaling/HttpSignalingSettings.cs | 6 +++--- .../Scripts/Signaling/WebSocketSignalingSettings.cs | 5 +++-- .../Runtime/Scripts/SignalingManager.cs | 5 ++++- 7 files changed, 22 insertions(+), 10 deletions(-) diff --git a/com.unity.renderstreaming/Editor/PropertyDrawers/SignalingSettingsDrawer.cs b/com.unity.renderstreaming/Editor/PropertyDrawers/SignalingSettingsDrawer.cs index 08074dfae..49cd0283c 100644 --- a/com.unity.renderstreaming/Editor/PropertyDrawers/SignalingSettingsDrawer.cs +++ b/com.unity.renderstreaming/Editor/PropertyDrawers/SignalingSettingsDrawer.cs @@ -43,7 +43,9 @@ PopupField CreatePopUpSignalingType(SerializedProperty property, string var settings = fieldInfo.GetValue(property.serializedObject.targetObject) as SignalingSettings; var defaultValue = CustomSignalingSettingsEditor.FindLabelByInspectedType(settings.GetType()); var choices = CustomSignalingSettingsEditor.Labels().ToList(); - return new PopupField(label: label, choices: choices, defaultValue: defaultValue); + var field = new PopupField(label: label, choices: choices, defaultValue: defaultValue); + field.tooltip = "Choose the signaling type. \"WebSocket\" or \"HTTP Polling\"."; + return field; } static void ReplaceVisualElement(VisualElement oldValue, VisualElement newValue) diff --git a/com.unity.renderstreaming/Editor/RenderStreamingProjectSettingsProvider.cs b/com.unity.renderstreaming/Editor/RenderStreamingProjectSettingsProvider.cs index 24b29f6cf..49e99ce17 100644 --- a/com.unity.renderstreaming/Editor/RenderStreamingProjectSettingsProvider.cs +++ b/com.unity.renderstreaming/Editor/RenderStreamingProjectSettingsProvider.cs @@ -20,6 +20,9 @@ internal class RenderStreamingProjectSettingsProvider : SettingsProvider private int currentSelectedSettingsAsset; private RenderStreamingSettings settings; + const string LabelRenderStreamingSettingsAsset = "Render Streaming Settings Asset"; + const string LabelCreateSettingsButton = "Create New Settings Asset"; + const string kSettingsPath = "Project/Render Streaming"; const string kTemplatePath = "Packages/com.unity.renderstreaming/Editor/UXML/RenderStreamingProjectSettings.uxml"; const string kStylePath = "Packages/com.unity.renderstreaming/Editor/Styles/RenderStreamingProjectSettings.uss"; @@ -59,10 +62,11 @@ public override void OnActivate(string searchContext, VisualElement rootElement) var defaultIndex = ArrayHelpers.IndexOf(availableRenderStreamingSettingsAssets, AssetDatabase.GetAssetPath(settings)); var choices = availableRenderStreamingSettingsAssets.ToList(); - var selectPopup = new PopupField(label: label, choices: choices, defaultIndex: defaultIndex) + var selectPopup = new PopupField(label: LabelRenderStreamingSettingsAsset, choices: choices, defaultIndex: defaultIndex) { name = "renderStreamingSettingsSelectPopup" }; + selectPopup.tooltip = "Choose the Render Streaming Settings."; selectPopup.RegisterValueChangedCallback(evt => { currentSelectedSettingsAsset = selectPopup.index; @@ -77,7 +81,7 @@ public override void OnActivate(string searchContext, VisualElement rootElement) }); selectorContainer.Add(selectPopup); - var createSettingsButton = new Button { text = "Create New Settings Asset" }; + var createSettingsButton = new Button { text = LabelCreateSettingsButton }; createSettingsButton.clicked += () => { CreateNewSettingsAsset(); diff --git a/com.unity.renderstreaming/Editor/SignalingManagerEditor.cs b/com.unity.renderstreaming/Editor/SignalingManagerEditor.cs index 4968ea896..702177d28 100644 --- a/com.unity.renderstreaming/Editor/SignalingManagerEditor.cs +++ b/com.unity.renderstreaming/Editor/SignalingManagerEditor.cs @@ -92,6 +92,7 @@ PopupField CreatePopUpSignalingType(SerializedProperty var paths = GetAvailableSignalingSettingsPath(); var field = new PopupField(label: label); + field.tooltip = "Choose the signaling settings."; field.formatSelectedValueCallback = v => AssetDatabase.GetAssetPath(v); field.formatListItemCallback = v => AssetDatabase.GetAssetPath(v); if (paths.Length == 0) diff --git a/com.unity.renderstreaming/Runtime/Scripts/RenderStreamingSettings.cs b/com.unity.renderstreaming/Runtime/Scripts/RenderStreamingSettings.cs index f803e105e..dc22c7f51 100644 --- a/com.unity.renderstreaming/Runtime/Scripts/RenderStreamingSettings.cs +++ b/com.unity.renderstreaming/Runtime/Scripts/RenderStreamingSettings.cs @@ -13,7 +13,8 @@ public class RenderStreamingSettings : ScriptableObject /// /// /// - [SerializeField] public bool automaticStreaming; + [SerializeField, Tooltip("Automatically performs the necessary setup for streaming and starts streaming.")] + public bool automaticStreaming; [SerializeReference, SignalingSettings] public SignalingSettings signalingSettings = new WebSocketSignalingSettings(); diff --git a/com.unity.renderstreaming/Runtime/Scripts/Signaling/HttpSignalingSettings.cs b/com.unity.renderstreaming/Runtime/Scripts/Signaling/HttpSignalingSettings.cs index 485b995d9..de7e9e893 100644 --- a/com.unity.renderstreaming/Runtime/Scripts/Signaling/HttpSignalingSettings.cs +++ b/com.unity.renderstreaming/Runtime/Scripts/Signaling/HttpSignalingSettings.cs @@ -29,11 +29,11 @@ public class HttpSignalingSettings : SignalingSettings /// public int interval => m_interval; - [SerializeField] + [SerializeField, Tooltip("Set the polling frequency (in milliseconds) to the signaling server.")] private int m_interval; - [SerializeField] + [SerializeField, Tooltip("Set the signaling server URL. you should specify a URL starting with \"http\" or \"https\".")] protected string m_url; - [SerializeField] + [SerializeField, Tooltip("Set a list of STUN/TURN servers.")] protected IceServer[] m_iceServers; /// diff --git a/com.unity.renderstreaming/Runtime/Scripts/Signaling/WebSocketSignalingSettings.cs b/com.unity.renderstreaming/Runtime/Scripts/Signaling/WebSocketSignalingSettings.cs index d56718453..2e9514543 100644 --- a/com.unity.renderstreaming/Runtime/Scripts/Signaling/WebSocketSignalingSettings.cs +++ b/com.unity.renderstreaming/Runtime/Scripts/Signaling/WebSocketSignalingSettings.cs @@ -27,9 +27,10 @@ public class WebSocketSignalingSettings : SignalingSettings /// public string url => m_url; - [SerializeField] + [SerializeField, Tooltip("Set the signaling server URL. you should specify a URL starting with \"ws\" or \"wss\".")] protected string m_url; - [SerializeField] + + [SerializeField, Tooltip("Set a list of STUN/TURN servers.")] protected IceServer[] m_iceServers; /// diff --git a/com.unity.renderstreaming/Runtime/Scripts/SignalingManager.cs b/com.unity.renderstreaming/Runtime/Scripts/SignalingManager.cs index 33a357b4f..b9f8a22a1 100644 --- a/com.unity.renderstreaming/Runtime/Scripts/SignalingManager.cs +++ b/com.unity.renderstreaming/Runtime/Scripts/SignalingManager.cs @@ -24,7 +24,7 @@ public sealed class SignalingManager : MonoBehaviour internal const string EvaluateCommandlineArgumentsPropertyName = nameof(evaluateCommandlineArguments); #pragma warning disable 0649 - [SerializeField] + [SerializeField, Tooltip("Use settings in Project Settings Window.")] private bool m_useDefault = true; [SerializeField] @@ -54,6 +54,9 @@ public sealed class SignalingManager : MonoBehaviour private SignalingEventProvider m_provider; private bool m_running; + /// + /// + /// public bool Running => m_running; static ISignaling CreateSignaling(SignalingSettings settings, SynchronizationContext context)