Skip to content

Commit

Permalink
fix: Add tooltips for Render Streaming Settings in Project Settings W…
Browse files Browse the repository at this point in the history
…indow (#937)
  • Loading branch information
karasusan authored Aug 4, 2023
1 parent 6538f64 commit d6e6249
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,9 @@ PopupField<string> 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<string>(label: label, choices: choices, defaultValue: defaultValue);
var field = new PopupField<string>(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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -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<string>(label: label, choices: choices, defaultIndex: defaultIndex)
var selectPopup = new PopupField<string>(label: LabelRenderStreamingSettingsAsset, choices: choices, defaultIndex: defaultIndex)
{
name = "renderStreamingSettingsSelectPopup"
};
selectPopup.tooltip = "Choose the Render Streaming Settings.";
selectPopup.RegisterValueChangedCallback(evt =>
{
currentSelectedSettingsAsset = selectPopup.index;
Expand All @@ -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();
Expand Down
1 change: 1 addition & 0 deletions com.unity.renderstreaming/Editor/SignalingManagerEditor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ PopupField<SignalingSettingsObject> CreatePopUpSignalingType(SerializedProperty
var paths = GetAvailableSignalingSettingsPath();

var field = new PopupField<SignalingSettingsObject>(label: label);
field.tooltip = "Choose the signaling settings.";
field.formatSelectedValueCallback = v => AssetDatabase.GetAssetPath(v);
field.formatListItemCallback = v => AssetDatabase.GetAssetPath(v);
if (paths.Length == 0)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ public class RenderStreamingSettings : ScriptableObject
/// <summary>
///
/// </summary>
[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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@ public class HttpSignalingSettings : SignalingSettings
/// </summary>
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;

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,10 @@ public class WebSocketSignalingSettings : SignalingSettings
/// </summary>
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;

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down Expand Up @@ -54,6 +54,9 @@ public sealed class SignalingManager : MonoBehaviour
private SignalingEventProvider m_provider;
private bool m_running;

/// <summary>
///
/// </summary>
public bool Running => m_running;

static ISignaling CreateSignaling(SignalingSettings settings, SynchronizationContext context)
Expand Down

0 comments on commit d6e6249

Please sign in to comment.