Skip to content
This repository was archived by the owner on Jan 18, 2022. It is now read-only.

Commit c028616

Browse files
Paul BalajiJamie BrynesSean Parker
authored
Tools config tooltips (#1470)
Co-authored-by: Jamie Brynes <[email protected]> Co-authored-by: Sean Parker <[email protected]>
1 parent 9da43ba commit c028616

File tree

2 files changed

+54
-17
lines changed

2 files changed

+54
-17
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212

1313
- Added `MeansImplicitUse` attribute to `RequireAttribute` to reduce warnings in Rider IDE. [#1462](https://github.com/spatialos/gdk-for-unity/pull/1462)
1414
- Added Event Tracing API. [#1452](https://github.com/spatialos/gdk-for-unity/pull/1452)
15+
- Added tooltips to the SpatialOS Project Settings. [#1470](https://github.com/spatialos/gdk-for-unity/pull/1470)
1516

1617
### Changed
1718

workers/unity/Packages/io.improbable.gdk.tools/GdkToolsConfigurationProvider.cs

Lines changed: 53 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
using System;
21
using System.Collections.Generic;
32
using System.Linq;
43
using System.IO;
@@ -16,7 +15,6 @@ public class GdkToolsConfigurationProvider : SettingsProvider
1615
{
1716
public const string ProjectSettingsPath = "Project/Spatial OS";
1817

19-
internal const string SchemaStdLibDirLabel = "Standard library";
2018
internal const string VerboseLoggingLabel = "Verbose logging";
2119
internal const string CodegenLogOutputDirLabel = "Log output directory";
2220
internal const string CodegenOutputDirLabel = "C# output directory";
@@ -109,6 +107,8 @@ public override void OnGUI(string searchContext)
109107

110108
DrawCodeGenerationOptions();
111109

110+
DrawDevAuthTokenOptions();
111+
112112
DrawCustomSnapshotDir();
113113

114114
if (check.changed)
@@ -152,13 +152,17 @@ private void DrawGeneralSection()
152152
GUILayout.Label(GeneralSectionLabel, EditorStyles.boldLabel);
153153
using (new EditorGUI.IndentLevelScope())
154154
{
155-
toolsConfig.EnvironmentPlatform = EditorGUILayout.TextField("Environment", toolsConfig.EnvironmentPlatform);
155+
toolsConfig.EnvironmentPlatform = EditorGUILayout.TextField(new GUIContent("Environment",
156+
"The environment argument to provide to GDK tooling such as the spatial CLI and Deployment Launcher."),
157+
toolsConfig.EnvironmentPlatform);
156158
}
157159

158160
using (new EditorGUI.IndentLevelScope())
159161
{
160162
toolsConfig.RuntimeVersionOverride =
161-
EditorGUILayout.TextField("Runtime Version Override", toolsConfig.RuntimeVersionOverride);
163+
EditorGUILayout.TextField(new GUIContent("Runtime Version Override",
164+
"Overrides the default runtime version used by the GDK for local and cloud deployments."),
165+
toolsConfig.RuntimeVersionOverride);
162166

163167
GUILayout.Label($"Current Runtime version: {toolsConfig.RuntimeVersion}", EditorStyles.helpBox);
164168
}
@@ -177,21 +181,33 @@ private void DrawCodeGenerationOptions()
177181
using (new EditorGUIUtility.IconSizeScope(new Vector2(12, 12)))
178182
using (new EditorGUI.IndentLevelScope())
179183
{
180-
toolsConfig.VerboseLogging = EditorGUILayout.Toggle(VerboseLoggingLabel, toolsConfig.VerboseLogging);
184+
toolsConfig.VerboseLogging = EditorGUILayout.Toggle(new GUIContent(VerboseLoggingLabel,
185+
"Toggles verbose logging of the code generator."),
186+
toolsConfig.VerboseLogging);
181187

182188
toolsConfig.CodegenLogOutputDir =
183-
EditorGUILayout.TextField(CodegenLogOutputDirLabel, toolsConfig.CodegenLogOutputDir);
189+
EditorGUILayout.TextField(new GUIContent(CodegenLogOutputDirLabel,
190+
"The directory, relative to the Unity project root, where code generator places its log files."),
191+
toolsConfig.CodegenLogOutputDir);
184192

185193
toolsConfig.CodegenOutputDir =
186-
EditorGUILayout.TextField(CodegenOutputDirLabel, toolsConfig.CodegenOutputDir);
194+
EditorGUILayout.TextField(new GUIContent(CodegenOutputDirLabel,
195+
"The directory, relative to the Unity project root, where the code generator should place non-Editor generated code."),
196+
toolsConfig.CodegenOutputDir);
187197

188-
toolsConfig.CodegenEditorOutputDir = EditorGUILayout.TextField(CodegenEditorOutputDirLabel,
198+
toolsConfig.CodegenEditorOutputDir = EditorGUILayout.TextField(new GUIContent(CodegenEditorOutputDirLabel,
199+
"The directory, relative to the Unity project root, where the code generator should place Editor-specific generated code."),
189200
toolsConfig.CodegenEditorOutputDir);
190201

191202
toolsConfig.DescriptorOutputDir =
192-
EditorGUILayout.TextField(DescriptorOutputDirLabel, toolsConfig.DescriptorOutputDir);
193-
194-
EditorGUILayout.LabelField($"{SchemaSourceDirsLabel}", EditorStyles.boldLabel);
203+
EditorGUILayout.TextField(new GUIContent(DescriptorOutputDirLabel,
204+
"The directory, relative to the Unity project root, where the code generator should place the generated descriptor."),
205+
toolsConfig.DescriptorOutputDir);
206+
207+
EditorGUILayout.LabelField(new GUIContent($"{SchemaSourceDirsLabel}",
208+
"A list of directories, relative to the Unity project root, containing schema that are not already in a package." +
209+
" Note that the GDK automatically finds and provides paths to any `.schema` folder found inside a package."),
210+
EditorStyles.boldLabel);
195211
using (new EditorGUI.IndentLevelScope())
196212
{
197213
for (var i = 0; i < toolsConfig.SchemaSourceDirs.Count; i++)
@@ -221,16 +237,32 @@ private void DrawCodeGenerationOptions()
221237
}
222238
}
223239

240+
EditorGUIUtility.labelWidth = previousWidth;
241+
}
242+
243+
private void DrawDevAuthTokenOptions()
244+
{
245+
var previousWidth = EditorGUIUtility.labelWidth;
246+
EditorGUIUtility.labelWidth = 180;
247+
224248
GUILayout.Label(DevAuthTokenSectionLabel, EditorStyles.boldLabel);
225249
using (new EditorGUI.IndentLevelScope())
226250
{
227251
toolsConfig.DevAuthTokenLifetimeDays =
228-
EditorGUILayout.IntSlider(DevAuthTokenLifetimeLabel, toolsConfig.DevAuthTokenLifetimeDays, 1, 90);
229-
230-
toolsConfig.SaveDevAuthTokenToFile = EditorGUILayout.Toggle("Save token to file", toolsConfig.SaveDevAuthTokenToFile);
252+
EditorGUILayout.IntSlider(new GUIContent(DevAuthTokenLifetimeLabel,
253+
"Sets the lifetime for requested development authentication tokens, between 1 and 90 days. " +
254+
"Changes made to this setting do not affect existing tokens."),
255+
toolsConfig.DevAuthTokenLifetimeDays, 1, 90);
256+
257+
toolsConfig.SaveDevAuthTokenToFile = EditorGUILayout.Toggle(new GUIContent("Save token to file",
258+
"Sets whether to save the development authentication token to a file, instead of in player preferences."),
259+
toolsConfig.SaveDevAuthTokenToFile);
231260
using (new EditorGUI.DisabledScope(!toolsConfig.SaveDevAuthTokenToFile))
232261
{
233-
toolsConfig.DevAuthTokenDir = EditorGUILayout.TextField(DevAuthTokenDirLabel, toolsConfig.DevAuthTokenDir);
262+
toolsConfig.DevAuthTokenDir = EditorGUILayout.TextField(new GUIContent(DevAuthTokenDirLabel,
263+
"The directory, relative to the project's Assets/ folder, where development authentication tokens will be " +
264+
" saved to if saving to file is enabled. The full path is displayed in the window for ease of use."),
265+
toolsConfig.DevAuthTokenDir);
234266
GUILayout.Label($"Token filepath: {Path.GetFullPath(toolsConfig.DevAuthTokenFilepath)}", EditorStyles.helpBox);
235267
}
236268
}
@@ -240,13 +272,17 @@ private void DrawCodeGenerationOptions()
240272

241273
private void DrawCustomSnapshotDir()
242274
{
243-
GUILayout.Label(CustomSnapshotPathLabel, EditorStyles.boldLabel);
275+
GUILayout.Label(new GUIContent(CustomSnapshotPathLabel,
276+
"The snapshot the GDK will use for local deployments."),
277+
EditorStyles.boldLabel);
244278
GUILayout.Space(EditorGUIUtility.standardVerticalSpacing);
245279
using (new EditorGUILayout.HorizontalScope())
246280
{
247281
using (new EditorGUI.DisabledScope(true))
248282
{
249-
EditorGUILayout.TextField(CustomSnapshotPathLabel, toolsConfig.CustomSnapshotPath);
283+
EditorGUILayout.TextField(new GUIContent(CustomSnapshotPathLabel,
284+
"The snapshot the GDK will use for local deployments."),
285+
toolsConfig.CustomSnapshotPath);
250286
}
251287

252288
if (GUILayout.Button("Open", EditorStyles.miniButtonRight, GUILayout.ExpandWidth(false)))

0 commit comments

Comments
 (0)