-
Notifications
You must be signed in to change notification settings - Fork 404
Expand file tree
/
Copy pathRenderStreamingWizard.cs
More file actions
614 lines (518 loc) · 26.5 KB
/
RenderStreamingWizard.cs
File metadata and controls
614 lines (518 loc) · 26.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
using System;
using System.Linq;
using UnityEditor;
using UnityEditor.Callbacks;
using UnityEngine;
using UnityEngine.InputSystem;
using UnityEngine.Rendering;
using UnityEngine.UIElements;
namespace Unity.RenderStreaming.Editor
{
internal class RenderStreamingWizard : EditorWindow
{
private const string packageName = "com.unity.renderstreaming";
private static readonly BuildTarget[] supportedBuildTarget = {
BuildTarget.StandaloneWindows64,
BuildTarget.StandaloneOSX,
BuildTarget.StandaloneLinux64,
BuildTarget.iOS,
BuildTarget.Android
};
#if UNITY_6000_0_OR_NEWER
const AndroidSdkVersions RequiredAndroidSdkVersion = AndroidSdkVersions.AndroidApiLevel23;
#elif UNITY_2021_1_OR_NEWER
const AndroidSdkVersions RequiredAndroidSdkVersion = AndroidSdkVersions.AndroidApiLevel22;
#else
const AndroidSdkVersions RequiredAndroidSdkVersion = AndroidSdkVersions.AndroidApiLevel21;
#endif
private struct ConfigStyle
{
public readonly string label;
public readonly string error;
public readonly string button;
public readonly MessageType messageType;
public ConfigStyle(string label, string error, string button = "Fix",
MessageType messageType = MessageType.Error)
{
this.label = label;
this.error = error;
this.button = button;
this.messageType = messageType;
}
}
static readonly ConfigStyle runInBackground = new ConfigStyle(
label: "Run In Background",
error: "Run In Background must be True for Render Streaming to work in Background.");
static readonly ConfigStyle inputSystemSettingsAssets = new ConfigStyle(
label: "Input System Settings Assets",
error: "Input System Settings asset must exist under the Assets folder for changes.");
static readonly ConfigStyle inputSystemBackgroundBehavior = new ConfigStyle(
label: "InputSystem Background Behavior",
error: "InputSystem Background Behavior must be Ignore Focus for Input System to work in Background.");
static readonly ConfigStyle inputSystemPlayModeInputBehavior = new ConfigStyle(
label: "InputSystem PlayMode Input Behavior",
error: "InputSystem PlayMode Input behavior must be AllDeviceInputAlwaysGoesToGameView for InputSystem to work in background PlayMode.");
static readonly ConfigStyle currentBuildTarget = new ConfigStyle(
label: "Current BuildTarget platform",
error: "Current BuildTarget platform not supported.");
static readonly ConfigStyle currentGraphicsApi = new ConfigStyle(
label: "Current Graphics API",
error: "Current settings contains not support Graphics API.");
static readonly ConfigStyle macCameraUsageDescription = new ConfigStyle(
label: "macOS Camera Usage Description",
error: "Require Camera Usage Description for WebCam access on macOS.");
static readonly ConfigStyle macMicrophoneUsageDescription = new ConfigStyle(
label: "macOS Microphone Usage Description",
error: "Require Microphone Usage Description for Microphone access on macOS.");
static readonly ConfigStyle iOSCameraUsageDescription = new ConfigStyle(
label: "iOS Camera Usage Description",
error: "Require Camera Usage Description for WebCam access on iOS.");
static readonly ConfigStyle iOSMicrophoneUsageDescription = new ConfigStyle(
label: "iOS Microphone Usage Description",
error: "Require Microphone Usage Description for Microphone access on iOS.");
static readonly ConfigStyle androidMinimumAPILevel = new ConfigStyle(
label: "Android Minimum API Level",
error: $"The minimum Android SDK level required is {(int)RequiredAndroidSdkVersion} or higher.");
static readonly ConfigStyle androidScriptBackend = new ConfigStyle(
label: "Android Script Backend",
error: "Render Streaming only supports IL2CPP as a scripting backend.");
static readonly ConfigStyle androidTargetArchitecture = new ConfigStyle(
label: "Android Target Architecture",
error: "Render Streaming only supported ARM64 as a Android Target Architecture.");
static readonly ConfigStyle androidInternetAccess = new ConfigStyle(
label: "Android Internet Access",
error: "InternetAccess must be set Required on Android.");
enum Scope
{
PlayMode,
BuildSettings
}
struct Entry
{
public delegate bool Checker();
public delegate void Fixer();
public delegate bool DependChecker();
public readonly Scope scope;
public readonly ConfigStyle configStyle;
public readonly Checker check;
public readonly Fixer fix;
public readonly DependChecker dependChecker;
public readonly bool forceDisplayCheck;
public readonly bool skipErrorIcon;
public Entry(
Scope scope,
ConfigStyle configStyle,
Checker check,
Fixer fix,
DependChecker dependChecker = null,
bool forceDisplayCheck = false,
bool skipErrorIcon = false
)
{
this.scope = scope;
this.configStyle = configStyle;
this.check = check;
this.fix = fix;
this.dependChecker = dependChecker;
this.forceDisplayCheck = forceDisplayCheck;
this.skipErrorIcon = skipErrorIcon;
}
}
private Entry[] entries;
Entry[] Entries
{
get
{
// due to functor, cannot static link directly in an array and need lazy init
if (entries == null)
entries = new[]
{
new Entry(Scope.PlayMode, runInBackground, IsRunInBackgroundCorrect, FixRunInBackground),
new Entry(Scope.PlayMode, inputSystemSettingsAssets, IsInputSettingsAssetsExists, FixInputSettingsAssets),
new Entry(Scope.PlayMode, inputSystemBackgroundBehavior,
IsInputSystemBackgroundBehaviorCorrect,
FixInputSystemBackgroundBehavior,
IsInputSettingsAssetsExists),
new Entry(Scope.PlayMode, inputSystemPlayModeInputBehavior,
IsInputSystemPlayModeInputBehaviorCorrect,
FixInputSystemPlayModeInputBehavior,
IsInputSettingsAssetsExists),
new Entry(Scope.BuildSettings, currentBuildTarget, IsSupportedBuildTarget, FixSupportedBuildTarget),
new Entry(Scope.BuildSettings, currentGraphicsApi, IsSupportedGraphics, FixSupportedGraphics),
new Entry(Scope.BuildSettings, macCameraUsageDescription, IsMacCameraUsageCorrect, FixMacCameraUsage),
new Entry(Scope.BuildSettings, macMicrophoneUsageDescription, IsMacMicrophoneUsageCorrect,
FixMacMicrophoneUsage),
new Entry(Scope.BuildSettings, iOSCameraUsageDescription, IsIOSCameraUsageCorrect, FixIOSCameraUsage),
new Entry(Scope.BuildSettings, iOSMicrophoneUsageDescription, IsIOSMicrophoneUsageCorrect,
FixIOSMicrophoneUsage),
new Entry(Scope.BuildSettings, androidMinimumAPILevel, IsAndroidMinimumAPILevelCorrect,
FixAndroidMinimumAPILevel),
new Entry(Scope.BuildSettings, androidScriptBackend, IsAndroidScriptBackendCorrect,
FixAndroidScriptBackend),
new Entry(Scope.BuildSettings, androidTargetArchitecture, IsAndroidTargetArchitectureCorrect,
FixAndroidTargetArchitecture),
new Entry(Scope.BuildSettings, androidInternetAccess, IsAndroidInternetAccessCorrect,
FixAndroidInternetAccess),
};
return entries;
}
}
private static bool IsRunInBackgroundCorrect() => PlayerSettings.runInBackground;
private static void FixRunInBackground() => PlayerSettings.runInBackground = true;
private static bool IsInputSettingsAssetsExists()
{
var path = AssetDatabase.GetAssetPath(UnityEngine.InputSystem.InputSystem.settings);
return !string.IsNullOrEmpty(path) && path.StartsWith("Assets/");
}
private static void FixInputSettingsAssets()
{
var inputSettings = CreateInstance<InputSettings>();
AssetDatabase.CreateAsset(inputSettings, $"Assets/{PlayerSettings.productName}.inputsettings.asset");
UnityEngine.InputSystem.InputSystem.settings = inputSettings;
}
private static bool IsInputSystemBackgroundBehaviorCorrect() =>
UnityEngine.InputSystem.InputSystem.settings.backgroundBehavior == InputSettings.BackgroundBehavior.IgnoreFocus;
private static void FixInputSystemBackgroundBehavior()
{
UnityEngine.InputSystem.InputSystem.settings.backgroundBehavior = InputSettings.BackgroundBehavior.IgnoreFocus;
EditorUtility.SetDirty(UnityEngine.InputSystem.InputSystem.settings);
}
private static bool IsInputSystemPlayModeInputBehaviorCorrect() =>
UnityEngine.InputSystem.InputSystem.settings.editorInputBehaviorInPlayMode ==
InputSettings.EditorInputBehaviorInPlayMode.AllDeviceInputAlwaysGoesToGameView;
private static void FixInputSystemPlayModeInputBehavior()
{
UnityEngine.InputSystem.InputSystem.settings.editorInputBehaviorInPlayMode = InputSettings.EditorInputBehaviorInPlayMode.AllDeviceInputAlwaysGoesToGameView;
EditorUtility.SetDirty(UnityEngine.InputSystem.InputSystem.settings);
}
private static bool IsSupportedBuildTarget()
{
var correctBuildTarget = supportedBuildTarget.Contains(EditorUserBuildSettings.activeBuildTarget);
#if UNITY_2021_1_OR_NEWER
correctBuildTarget = correctBuildTarget && EditorUserBuildSettings.standaloneBuildSubtarget == StandaloneBuildSubtarget.Player;
#endif
return correctBuildTarget;
}
private static void FixSupportedBuildTarget()
{
BuildTarget target = default;
#if UNITY_EDITOR_WIN
target = BuildTarget.StandaloneWindows64;
#elif UNITY_EDITOR_OSX
target = BuildTarget.StandaloneOSX;
#elif UNITY_EDITOR_LINUX
target = BuildTarget.StandaloneLinux64;
#else
throw new NotSupportedException();
#endif
EditorUserBuildSettings.SwitchActiveBuildTarget(BuildPipeline.GetBuildTargetGroup(target), target);
#if UNITY_2021_1_OR_NEWER
EditorUserBuildSettings.standaloneBuildSubtarget = StandaloneBuildSubtarget.Player;
#endif
}
private static bool IsSupportedGraphics() => supportedBuildTarget.All(CheckGraphicsApi);
private static bool CheckGraphicsApi(BuildTarget target)
{
var targetGraphics = PlayerSettings.GetGraphicsAPIs(target);
switch (target)
{
case BuildTarget.StandaloneOSX:
case BuildTarget.iOS:
return targetGraphics.All(x => x == GraphicsDeviceType.Metal);
case BuildTarget.Android:
return targetGraphics.All(x => x == GraphicsDeviceType.OpenGLES3 || x == GraphicsDeviceType.Vulkan);
case BuildTarget.StandaloneWindows64:
return targetGraphics.All(x => x == GraphicsDeviceType.Direct3D11 || x == GraphicsDeviceType.Direct3D12 || x == GraphicsDeviceType.Vulkan);
case BuildTarget.StandaloneLinux64:
return targetGraphics.All(x => x == GraphicsDeviceType.OpenGLCore || x == GraphicsDeviceType.Vulkan);
default:
return false;
}
}
private static void FixSupportedGraphics()
{
foreach (var target in supportedBuildTarget.Where(x => !CheckGraphicsApi(x)))
{
switch (target)
{
case BuildTarget.StandaloneOSX:
case BuildTarget.iOS:
PlayerSettings.SetGraphicsAPIs(target, new[] { GraphicsDeviceType.Metal });
break;
case BuildTarget.Android:
PlayerSettings.SetGraphicsAPIs(target, new[] { GraphicsDeviceType.OpenGLES3, GraphicsDeviceType.Vulkan });
break;
case BuildTarget.StandaloneWindows64:
PlayerSettings.SetGraphicsAPIs(target, new[] { GraphicsDeviceType.Direct3D11, GraphicsDeviceType.Direct3D12, GraphicsDeviceType.Vulkan });
break;
case BuildTarget.StandaloneLinux64:
PlayerSettings.SetGraphicsAPIs(target, new[] { GraphicsDeviceType.OpenGLCore, GraphicsDeviceType.Vulkan });
break;
default:
throw new NotSupportedException($"{nameof(target)} is not supported.");
}
}
}
private static bool IsMacCameraUsageCorrect() =>
!string.IsNullOrEmpty(PlayerSettings.macOS.cameraUsageDescription);
private static void FixMacCameraUsage() => PlayerSettings.macOS.cameraUsageDescription = "For WebCamTexture";
private static bool IsMacMicrophoneUsageCorrect() =>
!string.IsNullOrEmpty(PlayerSettings.iOS.microphoneUsageDescription);
private static void FixMacMicrophoneUsage() => PlayerSettings.iOS.microphoneUsageDescription = "For Microphone";
private static bool IsIOSCameraUsageCorrect() =>
!string.IsNullOrEmpty(PlayerSettings.iOS.cameraUsageDescription);
private static void FixIOSCameraUsage() => PlayerSettings.iOS.cameraUsageDescription = "For WebCamTexture";
private static bool IsIOSMicrophoneUsageCorrect() =>
!string.IsNullOrEmpty(PlayerSettings.iOS.microphoneUsageDescription);
private static void FixIOSMicrophoneUsage() => PlayerSettings.iOS.microphoneUsageDescription = "For Microphone";
private static bool IsAndroidMinimumAPILevelCorrect() =>
PlayerSettings.Android.minSdkVersion >= RequiredAndroidSdkVersion;
private static void FixAndroidMinimumAPILevel() =>
PlayerSettings.Android.minSdkVersion = RequiredAndroidSdkVersion;
private static bool IsAndroidScriptBackendCorrect() =>
PlayerSettings.GetScriptingBackend(BuildTargetGroup.Android) == ScriptingImplementation.IL2CPP;
private static void FixAndroidScriptBackend() =>
PlayerSettings.SetScriptingBackend(BuildTargetGroup.Android, ScriptingImplementation.IL2CPP);
private static bool IsAndroidTargetArchitectureCorrect() =>
PlayerSettings.Android.targetArchitectures == AndroidArchitecture.ARM64;
private static void FixAndroidTargetArchitecture() =>
PlayerSettings.Android.targetArchitectures = AndroidArchitecture.ARM64;
private static bool IsAndroidInternetAccessCorrect() => PlayerSettings.Android.forceInternetPermission;
private static void FixAndroidInternetAccess() => PlayerSettings.Android.forceInternetPermission = true;
const string kTemplatePath = "Packages/com.unity.renderstreaming/Editor/UXML/RenderStreamingWizard.uxml";
const string kStylePath = "Packages/com.unity.renderstreaming/Editor/Styles/RenderStreamingWizard.uss";
[MenuItem("Window/Render Streaming/Render Streaming Wizard", priority = 10000)]
static void OpenWindow()
{
var window = GetWindow<RenderStreamingWizard>("Render Streaming Wizard");
window.minSize = new Vector2(500, 450);
RenderStreamingProjectSettings.wizardPopupAlreadyShownOnce = true;
}
static RenderStreamingWizard()
{
WizardBehaviour();
}
private static int frameToWait;
private static void WizardBehaviourDelayed()
{
if (frameToWait > 0)
--frameToWait;
else
{
EditorApplication.update -= WizardBehaviourDelayed;
if (RenderStreamingProjectSettings.wizardIsStartPopup &&
!RenderStreamingProjectSettings.wizardPopupAlreadyShownOnce)
{
//Application.isPlaying cannot be called in constructor. Do it here
if (Application.isPlaying)
return;
OpenWindow();
}
EditorApplication.quitting += () => RenderStreamingProjectSettings.wizardPopupAlreadyShownOnce = false;
}
}
[DidReloadScripts]
static void CheckPersistentPopupAlreadyOpened()
{
EditorApplication.delayCall += () =>
{
if (RenderStreamingProjectSettings.wizardPopupAlreadyShownOnce)
EditorApplication.quitting +=
() => RenderStreamingProjectSettings.wizardPopupAlreadyShownOnce = false;
};
}
[DidReloadScripts]
static void WizardBehaviour()
{
//We need to wait at least one frame or the popup will not show up
frameToWait = 10;
EditorApplication.update += WizardBehaviourDelayed;
}
private void OnEnable()
{
var styleSheet = EditorGUIUtility.Load(kStylePath) as StyleSheet;
var uiAsset = AssetDatabase.LoadAssetAtPath<VisualTreeAsset>(kTemplatePath);
var newVisualElement = new VisualElement();
uiAsset.CloneTree(newVisualElement);
rootVisualElement.Add(newVisualElement);
rootVisualElement.styleSheets.Add(styleSheet);
BindCheckVersion();
BindCurrentSettings();
BindChecker();
BindWebApp();
BindCheckBox();
}
private int inspectorCounter = 0;
private Label currentSettingsLabel;
private HelpBox currentSettingsHelpBox;
private Button fixAllButton;
private VisualElement playmodeCheckButtons;
private VisualElement buildSettingsCheckButtons;
private void OnInspectorUpdate()
{
// limit inspector update per 1 second.
inspectorCounter++;
if (inspectorCounter % 10 != 0)
{
return;
}
if (currentSettingsLabel != null)
{
currentSettingsLabel.text = $"Current Render Streaming Settings: {GetSettingsAssetName()}";
}
if (currentSettingsHelpBox != null)
{
currentSettingsHelpBox.style.display = IsDefaultSetting() ? DisplayStyle.Flex : DisplayStyle.None;
}
fixAllButton?.SetEnabled(entries.Any(x => !x.check()));
if (playmodeCheckButtons != null && buildSettingsCheckButtons != null)
{
foreach (var visualElement in playmodeCheckButtons.Children()
.Concat(buildSettingsCheckButtons.Children())
.Select(c => c as ConfigInfoLine)
.Where(c => c != null))
{
visualElement.CheckUpdate();
}
}
inspectorCounter = 0;
}
private void BindCheckVersion()
{
var checkUpdateContainer = rootVisualElement.Q("checkUpdateContainer");
var label = new TextElement { text = "Current Render Streaming version: checking..." };
checkUpdateContainer.Add(label);
var button = new Button(() =>
UnityEditor.PackageManager.UI.Window.Open(packageName))
{ text = "Check update" };
button.AddToClassList("right-anchored-button");
checkUpdateContainer.Add(button);
RequestJobManager.CreateListRequest(true, true, (req) =>
{
var packageInfo = req.FindPackage(packageName);
if (null == packageInfo)
{
RenderStreaming.Logger.Log(LogType.Error, $"Not found package \"{packageName}\"");
return;
}
label.text = $"Current Render Streaming version: {packageInfo.version}";
}, null);
}
private void BindCurrentSettings()
{
var checkUpdateContainer = rootVisualElement.Q("currentSettingsContainer");
currentSettingsLabel = new Label { text = $"Current Render Streaming Settings: {GetSettingsAssetName()}" };
currentSettingsLabel.AddToClassList("normal");
checkUpdateContainer.Add(currentSettingsLabel);
var button = new Button(() => SettingsService.OpenProjectSettings("Project/Render Streaming"))
{
text = "Open Project Settings"
};
button.AddToClassList(("open-project-settings"));
checkUpdateContainer.Add(button);
currentSettingsHelpBox = new HelpBox("Current selected settings is default. If you want to change settings, open the Project Window and create or select another Settings.", HelpBoxMessageType.Info)
{
style = { display = IsDefaultSetting() ? DisplayStyle.Flex : DisplayStyle.None }
};
checkUpdateContainer.Add(currentSettingsHelpBox);
}
private static string GetSettingsAssetName()
{
var path = AssetDatabase.GetAssetPath(RenderStreaming.Settings);
var assetName = path == RenderStreaming.DefaultRenderStreamingSettingsPath ? "Default" : path.Split('/').Last();
return assetName;
}
private static bool IsDefaultSetting()
{
return AssetDatabase.GetAssetPath(RenderStreaming.Settings) == RenderStreaming.DefaultRenderStreamingSettingsPath;
}
private void BindChecker()
{
fixAllButton = rootVisualElement.Q<Button>("fixAllButton");
playmodeCheckButtons = rootVisualElement.Q("playmodeCheckButtons");
buildSettingsCheckButtons = rootVisualElement.Q("buildSettingsCheckButtons");
fixAllButton.clickable.clicked += () =>
{
foreach (var entry in Entries.Where(x => !x.check()))
{
entry.fix();
}
};
foreach (var entry in Entries.Where(x => x.scope == Scope.PlayMode))
{
playmodeCheckButtons.Add(new ConfigInfoLine(
entry.configStyle.label,
entry.configStyle.error,
entry.configStyle.messageType,
entry.configStyle.button,
() => entry.check(),
entry.fix == null ? (Action)null : () => entry.fix(),
entry.dependChecker == null ? (Func<bool>)null : () => entry.dependChecker(),
entry.configStyle.messageType == MessageType.Error || entry.forceDisplayCheck,
entry.skipErrorIcon));
}
foreach (var entry in Entries.Where(x => x.scope == Scope.BuildSettings))
{
buildSettingsCheckButtons.Add(new ConfigInfoLine(
entry.configStyle.label,
entry.configStyle.error,
entry.configStyle.messageType,
entry.configStyle.button,
() => entry.check(),
entry.fix == null ? (Action)null : () => entry.fix(),
entry.dependChecker == null ? (Func<bool>)null : () => entry.dependChecker(),
entry.configStyle.messageType == MessageType.Error || entry.forceDisplayCheck,
entry.skipErrorIcon));
}
}
private void BindWebApp()
{
var webappContainer = rootVisualElement.Q("webappContainer");
var webappButton = new Button(() =>
{
WebAppDownloader.GetPackageVersion(packageName, (version) =>
{
var dstPath = EditorUtility.OpenFolderPanel("Select download folder", "", "");
WebAppDownloader.DownloadWebApp(version, dstPath, null);
});
})
{ text = "Download latest version web app." };
webappButton.AddToClassList("large-button");
var showWebAppDocButton = new Button(() =>
{
WebAppDownloader.GetPackageVersion(packageName, (version) =>
{
var url = WebAppDownloader.GetURLDocumentation(version);
Application.OpenURL(url);
});
})
{ text = "Show web app documentation." };
showWebAppDocButton.AddToClassList("large-button");
var showWebAppSourceButton = new Button(() =>
{
WebAppDownloader.GetPackageVersion(packageName, (version) =>
{
var url = WebAppDownloader.GetURLSourceCode(version);
Application.OpenURL(url);
});
})
{ text = "Show web app source code." };
showWebAppSourceButton.AddToClassList("large-button");
webappContainer.Add(webappButton);
webappContainer.Add(showWebAppDocButton);
webappContainer.Add(showWebAppSourceButton);
}
private void BindCheckBox()
{
var wizardCheckboxContainer = rootVisualElement.Q("wizardCheckboxContainer");
var wizardCheckbox = new Toggle("Show on start")
{
name = "wizardCheckbox"
};
wizardCheckbox.SetValueWithoutNotify(RenderStreamingProjectSettings.wizardIsStartPopup);
wizardCheckbox.RegisterValueChangedCallback(evt
=> RenderStreamingProjectSettings.wizardIsStartPopup = evt.newValue);
wizardCheckboxContainer.Add(wizardCheckbox);
}
}
}