2using System.Collections;
3using System.Collections.Generic;
4using System.Collections.ObjectModel;
5using System.ComponentModel;
6using System.Diagnostics;
9using System.Reflection;
10using System.Runtime.CompilerServices;
11using System.Runtime.Versioning;
13using System.Threading;
15using UnityEditor.AnimatedValues;
16using UnityEditor.AssetImporters;
17using UnityEditor.Build;
18using UnityEditor.Build.Reporting;
19using UnityEditor.SceneManagement;
22using UnityEngine.Events;
23using UnityEngine.Networking;
24using UnityEngine.SceneManagement;
26using UnityEngine.UIElements;
37[assembly: CompilationRelaxations(8)]
38[assembly: RuntimeCompatibility(WrapNonExceptionThrows =
true)]
39[assembly: Debuggable()]
40[assembly: VRCAssetExporter()]
41[assembly: VRCSdkBuilder()]
42[assembly: InternalsVisibleTo(
"VRC.SDK3.Editor")]
43[assembly: UnityAPICompatibilityVersion(
"2022.3.22f1",
true)]
44[assembly: TargetFramework(
".NETStandard,Version=v2.1", FrameworkDisplayName =
".NET Standard 2.1")]
45[assembly: AssemblyCompany(
"VRCSDK3-Editor")]
46[assembly: AssemblyConfiguration(
"Release")]
47[assembly: AssemblyFileVersion(
"1.0.0.0")]
48[assembly: AssemblyInformationalVersion(
"1.0.0+77370df7b4055abf7cc0fb1da3c3d290108e9941")]
49[assembly: AssemblyProduct(
"VRCSDK3-Editor")]
50[assembly: AssemblyTitle(
"VRCSDK3-Editor")]
51[assembly: AssemblyVersion(
"1.0.0.0")]
54 private static List<string> _playerObjectsToEnableInPost;
61 GameObject[] rootGameObjects = ((Scene)(ref scene)).GetRootGameObjects();
62 for (
int i = 0; i < rootGameObjects.Length; i++)
64 vRCSceneDescriptor = rootGameObjects[i].GetComponentInChildren<
VRCSceneDescriptor>(
true);
65 if ((Object)(object)vRCSceneDescriptor != (Object)
null)
70 if ((Object)(object)vRCSceneDescriptor == (Object)
null)
74 List<VRCPlayerObject> val =
new List<VRCPlayerObject>();
75 _playerObjectsToEnableInPost =
new List<string>();
76 rootGameObjects = ((Scene)(ref scene)).GetRootGameObjects();
77 for (
int i = 0; i < rootGameObjects.Length; i++)
82 if (((Component)vRCPlayerObject).gameObject.activeInHierarchy)
84 _playerObjectsToEnableInPost.Add(((Object)vRCPlayerObject).name);
86 ((Component)vRCPlayerObject).gameObject.SetActive(
false);
87 val.Add(vRCPlayerObject);
92 vRCSceneDescriptor.PlayerPersistence = val.ToArray();
93 AssetDatabase.SaveAssets();
101 if (_playerObjectsToEnableInPost ==
null || _playerObjectsToEnableInPost.Count <= 0)
105 GameObject[] rootGameObjects = ((Scene)(ref scene)).GetRootGameObjects();
106 for (
int i = 0; i < rootGameObjects.Length; i++)
111 if (_playerObjectsToEnableInPost.Contains(((Object)vRCPlayerObject).name))
113 ((Component)vRCPlayerObject).gameObject.SetActive(
true);
117 EditorSceneManager.MarkSceneDirty(SceneManager.GetActiveScene());
118 EditorSceneManager.SaveOpenScenes();
123 [CanEditMultipleObjects]
171 ((SelectableEditor)
this).OnEnable();
172 m_TextComponent = ((Editor)
this).serializedObject.FindProperty(
"m_TextComponent");
173 m_Text = ((Editor)
this).serializedObject.FindProperty(
"m_Text");
174 m_ContentType = ((Editor)
this).serializedObject.FindProperty(
"m_ContentType");
175 m_LineType = ((Editor)
this).serializedObject.FindProperty(
"m_LineType");
176 m_InputType = ((Editor)
this).serializedObject.FindProperty(
"m_InputType");
178 m_KeyboardType = ((Editor)
this).serializedObject.FindProperty(
"m_KeyboardType");
179 m_CharacterLimit = ((Editor)
this).serializedObject.FindProperty(
"m_CharacterLimit");
180 m_CaretBlinkRate = ((Editor)
this).serializedObject.FindProperty(
"m_CaretBlinkRate");
181 m_CaretWidth = ((Editor)
this).serializedObject.FindProperty(
"m_CaretWidth");
182 m_CaretColor = ((Editor)
this).serializedObject.FindProperty(
"m_CaretColor");
183 m_CustomCaretColor = ((Editor)
this).serializedObject.FindProperty(
"m_CustomCaretColor");
184 m_SelectionColor = ((Editor)
this).serializedObject.FindProperty(
"m_SelectionColor");
185 m_HideMobileInput = ((Editor)
this).serializedObject.FindProperty(
"m_HideMobileInput");
186 m_Placeholder = ((Editor)
this).serializedObject.FindProperty(
"m_Placeholder");
187 m_OnValueChanged = ((Editor)
this).serializedObject.FindProperty(
"m_OnValueChanged");
188 m_OnEndEdit = ((Editor)
this).serializedObject.FindProperty(
"m_OnEndEdit");
189 m_ReadOnly = ((Editor)
this).serializedObject.FindProperty(
"m_ReadOnly");
191 ((BaseAnimValue<bool>)(
object)
m_CustomColor).valueChanged.AddListener(
new UnityAction(((Editor)
this).Repaint));
198 ((SelectableEditor)
this).OnDisable();
199 ((BaseAnimValue<bool>)(
object)
m_CustomColor).valueChanged.RemoveListener(
new UnityAction(((Editor)
this).Repaint));
204 ((Editor)
this).serializedObject.Update();
205 ((SelectableEditor)
this).OnInspectorGUI();
206 EditorGUILayout.Space();
207 EditorGUILayout.PropertyField(
m_TextComponent, Array.Empty<GUILayoutOption>());
210 EditorGUILayout.HelpBox(
"Using Rich Text with input is unsupported.", (MessageType)2);
212 DisabledScope val =
default(DisabledScope);
216 EditorGUILayout.PropertyField(
m_Text, Array.Empty<GUILayoutOption>());
217 EditorGUILayout.PropertyField(
m_CharacterLimit, Array.Empty<GUILayoutOption>());
218 EditorGUILayout.Space();
219 EditorGUILayout.PropertyField(
m_ContentType, Array.Empty<GUILayoutOption>());
222 EditorGUI.indentLevel += 1;
225 EditorGUILayout.PropertyField(
m_LineType, Array.Empty<GUILayoutOption>());
229 EditorGUILayout.PropertyField(
m_InputType, Array.Empty<GUILayoutOption>());
230 EditorGUILayout.PropertyField(
m_KeyboardType, Array.Empty<GUILayoutOption>());
233 EditorGUI.indentLevel -= 1;
235 EditorGUILayout.Space();
236 EditorGUILayout.PropertyField(
m_Placeholder, Array.Empty<GUILayoutOption>());
237 EditorGUILayout.PropertyField(
m_CaretBlinkRate, Array.Empty<GUILayoutOption>());
238 EditorGUILayout.PropertyField(
m_CaretWidth, Array.Empty<GUILayoutOption>());
243 EditorGUILayout.PropertyField(
m_CaretColor, Array.Empty<GUILayoutOption>());
245 EditorGUILayout.EndFadeGroup();
246 EditorGUILayout.PropertyField(
m_SelectionColor, Array.Empty<GUILayoutOption>());
247 EditorGUILayout.PropertyField(
m_HideMobileInput, Array.Empty<GUILayoutOption>());
248 EditorGUILayout.PropertyField(
m_ReadOnly, Array.Empty<GUILayoutOption>());
249 EditorGUILayout.Space();
250 EditorGUILayout.PropertyField(
m_OnValueChanged, Array.Empty<GUILayoutOption>());
251 EditorGUILayout.PropertyField(
m_OnEndEdit, Array.Empty<GUILayoutOption>());
255 ((IDisposable)(DisabledScope)(ref val)).Dispose();
257 ((Editor)
this).serializedObject.ApplyModifiedProperties();
263 [ScriptedImporter(1,
"mid")]
271 ctx.AddObjectToAsset(
"main obj", (Object)(
object)midiFile);
272 ctx.SetMainObject((Object)(
object)midiFile);
278 [CustomPropertyDrawer()]
281 public override void OnGUI(Rect _position, SerializedProperty _property, GUIContent _label)
286 int num2 = _property.enumNames.Length;
287 bool[] array = (
bool[])(
object)
new Boolean[num2];
288 float num3 = (((Rect)(ref _position)).width - EditorGUIUtility.labelWidth) / (float)num2;
289 EditorGUI.LabelField(
new Rect(((Rect)(ref _position)).x, ((Rect)(ref _position)).y, EditorGUIUtility.labelWidth, ((Rect)(ref _position)).height), _label);
290 EditorGUI.BeginChangeCheck();
291 Rect val =
default(Rect);
292 for (
int i = 0; i < num2; i++)
294 if ((_property.intValue & (1 << i)) == 1 << i)
298 ((Rect)(ref val))..ctor(((Rect)(ref _position)).x + EditorGUIUtility.labelWidth + num3 * (float)i, ((Rect)(ref _position)).y, num3, ((Rect)(ref _position)).height);
299 array[i] = GUI.Toggle(val, array[i], _property.enumNames[i], GUIStyle.op_Implicit(
"Button"));
305 if (EditorGUI.EndChangeCheck())
307 _property.intValue = num;
319 VisualElement val =
new VisualElement();
323 helpBoxVisualElement =
new HelpBoxVisualElement(
"VRCEnablePersistence must be a child of a VRCPlayerObject to enable persistence.", (HelpBoxMessageType)3);
325 val.Add((VisualElement)(
object)helpBoxVisualElement);
335 : base(message, messageType)
340 Label obj = UQueryExtensions.Q<Label>((VisualElement)(
object)
this, (string)
null, (
string)
null);
341 ((VisualElement)obj).style.whiteSpace = StyleEnum<WhiteSpace>.op_Implicit((WhiteSpace)0);
342 ((VisualElement)obj).style.fontSize = StyleLength.op_Implicit(12f);
369 if (!((Object)(object)vRCPlayerObject == (Object)
null))
371 string existingPlayerObjectChild;
374 Debug.LogError((
object)String.Concat((
string[])(object)
new String[5]
376 "Can't add VRCPlayerObject to ",
377 ((Editor)
this).target.name,
379 existingPlayerObjectParent,
380 " already has a VRCPlayerObject component. Nested VRCPlayerObject components are not supported."
382 Object.DestroyImmediate((Object)(object)vRCPlayerObject);
384 else if (
HasChildWithComponent(((Component)vRCPlayerObject).transform, out existingPlayerObjectChild))
386 Debug.LogError((
object)String.Concat((
string[])(object)
new String[5]
388 "Can't add VRCPlayerObject to ",
389 ((Editor)
this).target.name,
391 existingPlayerObjectChild,
392 " already has a VRCPlayerObject component. Nested VRCPlayerObject components are not supported."
394 Object.DestroyImmediate((Object)(object)vRCPlayerObject);
401 Transform parent = target.parent;
403 while ((Object)(
object)parent != (Object)
null)
405 if (((Component)parent).TryGetComponent<VRCPlayerObject>(ref vRCPlayerObject))
407 existingPlayerObjectParent = ((Object)parent).name;
410 parent = parent.parent;
412 existingPlayerObjectParent = String.Empty;
420 IEnumerator enumerator = ((Component)target).transform.GetEnumerator();
424 while (enumerator.MoveNext())
426 Transform val = (Transform)enumerator.Current;
427 if (((Component)val).TryGetComponent<VRCPlayerObject>(ref vRCPlayerObject))
429 existingPlayerObjectChild = ((Object)val).name;
440 IDisposable val2 = (IDisposable)(
object)((enumerator is IDisposable) ? enumerator :
null);
446 existingPlayerObjectChild = String.Empty;
455 VisualElement val =
new VisualElement();
456 HelpBoxVisualElement helpBoxVisualElement =
new HelpBoxVisualElement(
"Player Objects are automatically instantiated once for each player that joins, providing each player with their own copy of that GameObject, its UdonBehaviours, other components, and children. This object will be the template, and should not be modified or referenced after the world has loaded. Use Networking.GetPlayerObjects to get the player objects associated with a player instead.", (HelpBoxMessageType)1);
457 val.Add((VisualElement)(
object)helpBoxVisualElement);
472 : base(message, innerException)
485 : base(String.Format(
"ADB failed with exit code {0}.\nStdOut:{1}\nStdError:{2}", (object)
exitCode, (object)stdOut, (object)stdError))
500 : base(message, innerException)
514 internal bool <FindDynamicContent>
b__0(GameObject p)
516 return !prefabs.Contains(p);
520 public string Name =>
"VRCAvatarAssetExporter";
522 int IOrderedCallback.callbackOrder => 2147475455;
529 public void ExportCurrentSceneResource(
bool buildAssetBundle =
true, Action<string> onProgress =
null, Action<object> onContentProcessed =
null)
568 if (!EditorPrefs.HasKey(
"originalScenePath"))
570 activeScene = SceneManager.GetActiveScene();
571 text = ((Scene)(ref activeScene)).path;
575 text = EditorPrefs.GetString(
"originalScenePath");
577 string fileNameWithoutExtension = Path.GetFileNameWithoutExtension(text);
578 onProgress?.Invoke(
"Validating Scene");
580 if (array ==
null || array.Length != 1)
582 EditorUtility.DisplayDialog(
"Build Custom Scene",
"Scene needs exactly one VRC_SceneDescriptor",
"Ok");
586 if ((Object)(object)vRCSceneDescriptor == (Object)
null)
588 EditorUtility.DisplayDialog(
"Build Custom Scene",
"You must place a VRC_SceneDescriptor on the root of you custom scene",
"Ok");
593 EditorUtility.DisplayDialog(
"Build Custom Scene",
"You must add at least one spawn to spawns in your VRC_SceneDescriptor.",
"Ok");
596 onProgress?.Invoke(
"Preparing Scene");
600 ((
VRC_SceneDescriptor)vRCSceneDescriptor).layerCollisionArr = UpdateLayers.GetLayerCollisionArray();
602 EditorUtility.SetDirty((Object)(object)vRCSceneDescriptor);
603 Scene scene = ((Component)vRCSceneDescriptor).gameObject.scene;
608 EditorSceneManager.MarkSceneDirty(scene);
609 EditorSceneManager.SaveScene(scene);
610 onContentProcessed?.Invoke((
object)scene);
611 if (!buildAssetBundle)
613 onProgress?.Invoke(
"Skipping AssetBundle, Build Complete");
618 string text2 = ((Scene)(ref scene)).path;
619 onProgress?.Invoke(
"Exporting Scene");
621 if (fileNameWithoutExtension.Contains(
"."))
624 string text3 =
"Assets/customTmpScene12345.unity";
625 AssetDatabase.CopyAsset(text2, text3);
627 AssetDatabase.Refresh();
629 AssetDatabase.RemoveUnusedAssetBundleNames();
630 String[] obj =
new String[5]
638 BuildTarget activeBuildTarget = EditorUserBuildSettings.activeBuildTarget;
639 obj[1] = ((Object)(BuildTarget)(ref activeBuildTarget)).ToString();
641 activeScene = SceneManager.GetActiveScene();
642 obj[3] = ((Scene)(ref activeScene)).name;
644 string text4 = String.Concat((
string[])(object)obj);
645 string text5 = String.Concat(Application.temporaryCachePath,
"/", text4);
648 if (!String.IsNullOrEmpty(localLowPath))
650 text6 = Path.Combine((
string[])(object)
new String[5] { localLowPath,
"VRChat",
"VRChat",
"Worlds", text4 });
651 string directoryName = Path.GetDirectoryName(text6);
652 if (!String.IsNullOrEmpty(directoryName))
654 Directory.CreateDirectory(directoryName);
661 Keypair val =
default(Keypair);
662 LibResult val2 = VRCFastCrypto.GenerateSigningKey(ref val);
665 throw new Exception(String.Format(
"Failed to generate signing key: {0}", (
object)val2));
667 SigningKey signingKey = ((Keypair)(ref val)).SigningKey;
668 EditorPrefs.SetString(
"currentBuildingAssetBundleCodeSigningKey", Convert.ToBase64String(((SigningKey)(ref signingKey)).Key));
669 onProgress?.Invoke(
"Creating an Asset Bundle");
670 AssetBundleBuild[] array2 = (AssetBundleBuild[])(
object)
new AssetBundleBuild[1]
674 assetNames = (
string[])(
object)
new String[1] { text2 },
675 assetBundleName = text4
678 BuildTarget activeBuildTarget2 = EditorUserBuildSettings.activeBuildTarget;
679 BuildTargetGroup selectedBuildTargetGroup = EditorUserBuildSettings.selectedBuildTargetGroup;
680 onProgress?.Invoke(
"Building the Asset Bundle");
681 BuildPipeline.BuildAssetBundles(Application.temporaryCachePath, array2, (BuildAssetBundleOptions)32, EditorUserBuildSettings.activeBuildTarget);
682 if (!File.Exists(text5))
684 Logger.LogError(
"AssetBundle was not built", (DebugLevel)0, (Object)
null);
687 onProgress?.Invoke(
"Bundle Built, Processing Bundle");
688 uint num =
default(uint);
689 if (!BuildPipeline.GetCRCForAssetBundle(text5, ref num))
691 Logger.LogError(
"Failed to get CRC for asset bundle!", (DebugLevel)0, (Object)
null);
694 List<byte> obj2 =
new List<byte>();
696 obj2.Add((
byte)(num & 0xFFu));
697 obj2.Add((
byte)((num >> 8) & 0xFFu));
698 obj2.Add((
byte)((num >> 16) & 0xFFu));
699 obj2.Add((
byte)((num >> 24) & 0xFFu));
700 VerifyKey verifyKey = ((Keypair)(ref val)).VerifyKey;
701 obj2.AddRange((IEnumerable<byte>)(object)((VerifyKey)(ref verifyKey)).Key);
702 string text7 = Convert.ToBase64String(obj2.ToArray());
703 EditorUserBuildSettings.SwitchActiveBuildTarget(selectedBuildTargetGroup, activeBuildTarget2);
706 File.Copy(text5, text6,
true);
709 EditorPrefs.SetString(
"currentBuildingAssetBundlePath", text6);
710 EditorPrefs.SetString(
"currentBuildingAssetBundleWorldSignature", text7);
711 EditorPrefs.SetString(
"lastVRCPath", text6);
714 AssetDatabase.DeleteAsset(text2);
717 catch (Exception val3)
719 Exception val4 = val3;
720 Debug.LogError((
object)String.Concat(
"Export Exception - ", (val4 !=
null) ? ((Object)val4).ToString() :
null));
724 onProgress?.Invoke(
"Build Complete");
730 CS$<>8__locals0.prefabs =
new List<GameObject>();
731 List<Material> val =
new List<Material>();
733 desc.DynamicMaterials = val;
736 CS$<>8__locals0.prefabs.AddRange(Enumerable.Where<GameObject>((IEnumerable<GameObject>)(
object)desc.
DynamicPrefabs, (Func<GameObject, bool>)((GameObject p) => !CS$<>8__locals0.prefabs.Contains(p))));
738 desc.DynamicPrefabs = CS$<>8__locals0.prefabs;
739 String[] obj =
new String[5]
747 int count = CS$<>8__locals0.prefabs.Count;
748 obj[1] = ((Int32)(ref count)).ToString();
749 obj[2] =
" prefabs and ";
751 obj[3] = ((Int32)(ref count)).ToString();
752 obj[4] =
" materials";
753 Logger.Log(String.Concat((
string[])(object)obj), (DebugLevel)9, (Object)
null);
763 catch (Exception val)
765 Exception val2 = val;
766 Debug.LogError((
object)String.Concat((val2 !=
null) ? ((Object)val2).ToString() :
null,
"\n", val2.StackTrace));
771 public static void RunScene(
string bundleFilePath,
string pluginFilePath)
773 if (Tools.Platform ==
"android")
782 throw new WorldAssetExportException(
"An ADB command failed to execute.\nCheck the console for more details.", (Exception)(
object)innerException);
793 string text = UnityWebRequest.EscapeURL(bundleFilePath).Replace(
"+",
"%20");
794 string text2 = UnityWebRequest.EscapeURL(pluginFilePath).Replace(
"+",
"%20");
795 string randomDigits = Tools.GetRandomDigits(10);
796 string text3 = SDKClientUtilities.GetSavedVRCInstallPath();
797 if (String.IsNullOrEmpty(text3) || !File.Exists(text3))
799 text3 = String.Concat(
"vrchat://create?roomId=", randomDigits,
"&hidden=true&name=BuildAndRun&url=file:///", text);
800 if (!String.IsNullOrEmpty(text2))
802 text3 = String.Concat(text3,
"&pluginUrl=file:///", text2);
805 string text4 = String.Concat(
"--url=create?roomId=", randomDigits,
"&hidden=true&name=BuildAndRun&url=file:///", text);
806 if (!String.IsNullOrEmpty(text2))
808 text4 = String.Concat(text4,
"&pluginUrl=file:///", text2);
810 string text5 = (VRCSettings.ForceNoVR ?
" --no-vr" :
"");
811 string text6 = (VRCSettings.WatchWorlds ?
" --watch-worlds" :
"");
812 string text7 = String.Concat(
"--enable-debug-gui --enable-sdk-log-levels --enable-udon-debug-logging ", text5, text6);
813 ProcessStartInfo val =
new ProcessStartInfo(text3, String.Concat(text4,
" ", text7))
815 WorkingDirectory = (Path.GetDirectoryName(text3) ??
"")
831 if (androidDevices.Count < 1)
833 throw new WorldAssetExportException(
"No android devices with ADB debugging enabled have been found.\nPlease plug in the device and enable USB debugging in the \"System\"->\"Developer Options\" settings section.\nNote that the \"System\"->\"Developer Options\" section only appears if you've enabled developer mode in Android, which you can enable by tapping \"About Phone\"->\"Build Number\" 7 times\n\nIf your device is still not appearing after trying the above, please try the following:\n1. Unplug the Android device\n2. Disable developer mode and USB debugging\n3. Plug in the Android device\n4. Enable developer mode by tapping \"About Phone\"->\"Build Number\" 7 times\n5. Enable USB debugging in the \"System\"->\"Developer Options\" section\n6. Attempt to Build and Test again.");
835 if (androidDevices.Count > 1)
837 throw new WorldAssetExportException(String.Concat(
"Multiple devices with ADB debugging enabled have been found. Unplug or disable USB debugging until the one device you would like to test on remains.\nCurrently available devices:\n", String.Join(
"\n", (IEnumerable<string>)(
object)androidDevices)));
839 string text = Enumerable.First<
string>((IEnumerable<string>)(
object)androidDevices);
840 Debug.Log((
object)String.Concat(
"Testing on ADB device ", text));
844 if (text.ToLower().Contains(
"model:quest"))
860 throw new WorldAssetExportException(
"Failed to test Android world: Device is locked.\nYour device must remain unlocked when starting a test build.\n\nEnsure that you are logged into the Meta Quest Developer Hub and your headset is properly connected before attempting to test an Android world.");
862 throw new WorldAssetExportException(
"Failed to test Android world: Device is locked.\nYour device must remain unlocked when starting a test build.\n\nYou may find it useful to enable the \"Stay Awake\" option in \"System\"->\"Developer Options\" to prevent the phone from locking while it's plugged in and charging.");
864 Debug.LogWarning((
object)
"Unable to determine if Android device is locked.\nNote that on some devices the device must remain unlocked for the VRChat app to be launched. Leave your device unlocked if the app is not launching.");
867 string extension = Path.GetExtension(bundleFilePath);
868 DateTime utcNow = DateTime.UtcNow;
869 string text4 = String.Format(
"{0}_{1}", (
object)((DateTime)(ref utcNow)).ToFileTimeUtc(), (
object)extension).TrimStart(
'/');
870 text3 = text3.TrimEnd(
'/');
873 string[] array = Array.Empty<
string>();
880 Debug.LogWarning((
object)
"Unable to find potential VRChat app packages");
882 StringBuilder val2 =
new StringBuilder();
883 val2.AppendLine(
"Unable to find a valid vrchat app directory on the device. Is the VRChat app installed?");
885 val2.AppendLine(String.Concat(
"Looking for '", text3,
"'."));
886 if (array.Length != 0)
888 string text5 = String.Join(
"\n", Enumerable.Select<
string,
string>((IEnumerable<string>)(
object)array, (Func<string, string>)((
string x) => String.Concat(
"\t", x))));
889 val2.AppendLine(
"Potential app package names found on device:");
890 val2.AppendLine(text5);
892 string text6 =
"Android App Package Name";
895 text6 =
"Quest App Package Name";
897 val2.AppendLine(String.Concat(
"Use the project setting \"VRChat\"->\"SDK\"->\"", text6,
"\" to change where the SDK looks for your app."));
898 if (array.Length == 1)
900 val2.AppendLine(String.Concat((
string[])(
object)
new String[5]
902 "Try changing \"VRChat\"->\"SDK\"->\"",
905 Enumerable.First<string>((IEnumerable<string>)(object)array),
910 val2.AppendLine(
"If you've just installed the app, launch it once before trying to build and test.");
912 val2.AppendLine(
"Note that the following Android device is being used:");
913 val2.AppendLine(text);
917 string text7 = String.Concat(text3,
"/files/TestWorlds/", text4);
920 ADB.
Command(
"shell",
"content",
"call",
"--method",
"scan_volume",
"--uri",
"content://media",
"--arg",
"external_primary");
923 AnalyticsSDK.BuildAndTestLaunched(flag ?
"Quest" :
"AndroidGeneric", text);
933 catch (Win32Exception val)
935 Win32Exception val2 = val;
936 if (!((Exception)val2).Message.Contains(
"The system cannot find the file specified"))
940 throw new WorldAssetExportException(
"Unable to locate Android Debug Bridge (adb.exe). Please be sure to install the Android SDK as a Unity module, or add adb.exe to the PATH.", (Exception)(
object)val2);
947 string text = String.Concat(appPath,
"/files/TestWorlds");
951 adbResult =
ADB.
Command(
"shell",
"find", text,
"-mindepth",
"1",
"-mtime",
"+1",
"-delete");
953 catch (Exception val)
955 Exception val2 = val;
956 if (val2.Message.Contains(
"No such file or directory"))
962 IEnumerator<string> enumerator = Enumerable.Select<string,
string>((IEnumerable<string>)(
object)adbResult.
standardOut.Split(
"\n", (StringSplitOptions)0), (Func<string, string>)((
string x) => x.Trim())).GetEnumerator();
965 while (((IEnumerator)enumerator).MoveNext())
967 string current = enumerator.Current;
968 if (!String.IsNullOrWhiteSpace(current) && !String.IsNullOrEmpty(current))
970 Debug.Log((
object)String.Concat(
"Deleted old test world file ", current,
" on remote device"));
976 if (enumerator !=
null)
978 ((IDisposable)enumerator).Dispose();
983 [Obsolete(
"Use methods from VRC.SDKBase.Editor.Api.VRCApi class for uploads instead")]
986 Debug.LogError((
object)
"Uploading via AssetExporter is no longer supported");
996 string @
string = EditorPrefs.GetString(
"currentBuildingAssetBundlePath");
997 if (!String.IsNullOrEmpty(@
string))
999 string string2 = EditorPrefs.GetString(
"externalPluginPath");
1000 EditorPrefs.DeleteKey(
"externalPluginPath");
1005 void IProcessSceneWithReport.OnProcessScene(Scene scene, BuildReport report)
1010 if (Application.isPlaying || EditorApplication.isPlayingOrWillChangePlaymode)
1014 string @
string = EditorPrefs.GetString(
"currentBuildingAssetBundleCodeSigningKey");
1015 if (String.IsNullOrEmpty(@
string))
1017 Debug.LogWarning((
object)
"No signing key found, skipping Udon code signing");
1022 SigningKey signingKey =
new SigningKey(Convert.FromBase64String(@
string));
1026 while (((IEnumerator)enumerator).MoveNext())
1028 Type type = enumerator.Current.type;
1029 if (!type.IsSubclassOf(typeof(ScriptableObject)))
1033 Stopwatch val = Stopwatch.StartNew();
1034 Object[] array = Resources.FindObjectsOfTypeAll(type);
1035 Object[] array2 = array;
1036 foreach (Object val2
in array2)
1040 udonSignatureHolder.EnsureGZipFormat();
1041 udonSignatureHolder.Signature = Sign(udonSignatureHolder.SignedData);
1042 EditorUtility.SetDirty(val2);
1045 Debug.Log((
object)String.Format(
"Computed code signatures for {0} scripts of type {1} in {2}ms", (
object)array.Length, (
object)((MemberInfo)type).Name, (
object)val.ElapsedMilliseconds));
1050 if (enumerator !=
null)
1052 ((IDisposable)enumerator).Dispose();
1056 byte[] Sign(
byte[] data)
1063 if (data ==
null || data.Length == 0)
1065 Debug.LogError((
object)
"Cannot sign empty data");
1068 byte[] result =
default(
byte[]);
1069 LibResult val5 = VRCFastCrypto.SignMessage(ref signingKey, ref data, ref result);
1072 throw new Exception(String.Format(
"Failed to sign data: {0}", (
object)val5));
1077 catch (Exception val3)
1079 Exception val4 = val3;
1080 Debug.LogError((
object)String.Concat(
"Failed to compute Udon signatures: ", (val4 !=
null) ? ((Object)val4).ToString() :
null));
1085 EditorPrefs.DeleteKey(
"currentBuildingAssetBundleCodeSigningKey");
1112 public string Name =>
"VRCWorldBuilder";
1126 EventHandler val3 = (EventHandler)Delegate.Combine((Delegate)(object)val2, (Delegate)(object)value);
1127 val = Interlocked.CompareExchange<EventHandler>(ref this.
m_OnBuildStarted, val3, val2);
1129 while (val != val2);
1141 EventHandler val3 = (EventHandler)Delegate.Remove((Delegate)(object)val2, (Delegate)(object)value);
1142 val = Interlocked.CompareExchange<EventHandler>(ref this.
m_OnBuildStarted, val3, val2);
1144 while (val != val2);
1154 EventHandler<string> val2;
1158 EventHandler<string> val3 = (EventHandler<string>)(
object)Delegate.Combine((Delegate)(object)val2, (Delegate)(object)value);
1159 val = Interlocked.CompareExchange<EventHandler<string>>(ref this.
m_OnBuildProgress, val3, val2);
1161 while (val != val2);
1167 EventHandler<string> val2;
1171 EventHandler<string> val3 = (EventHandler<string>)(
object)Delegate.Remove((Delegate)(object)val2, (Delegate)(object)value);
1172 val = Interlocked.CompareExchange<EventHandler<string>>(ref this.
m_OnBuildProgress, val3, val2);
1174 while (val != val2);
1184 EventHandler<object> val2;
1188 EventHandler<object> val3 = (EventHandler<object>)(
object)Delegate.Combine((Delegate)(object)val2, (Delegate)(object)value);
1191 while (val != val2);
1197 EventHandler<object> val2;
1201 EventHandler<object> val3 = (EventHandler<object>)(
object)Delegate.Remove((Delegate)(object)val2, (Delegate)(object)value);
1204 while (val != val2);
1214 EventHandler<string> val2;
1218 EventHandler<string> val3 = (EventHandler<string>)(
object)Delegate.Combine((Delegate)(object)val2, (Delegate)(object)value);
1219 val = Interlocked.CompareExchange<EventHandler<string>>(ref this.
m_OnBuildSuccess, val3, val2);
1221 while (val != val2);
1227 EventHandler<string> val2;
1231 EventHandler<string> val3 = (EventHandler<string>)(
object)Delegate.Remove((Delegate)(object)val2, (Delegate)(object)value);
1232 val = Interlocked.CompareExchange<EventHandler<string>>(ref this.
m_OnBuildSuccess, val3, val2);
1234 while (val != val2);
1244 EventHandler<ValueTuple<string, string>> val2;
1248 EventHandler<ValueTuple<string, string>> val3 = (EventHandler<ValueTuple<string, string>>)(
object)Delegate.Combine((Delegate)(object)val2, (Delegate)(object)value);
1251 while (val != val2);
1257 EventHandler<ValueTuple<string, string>> val2;
1261 EventHandler<ValueTuple<string, string>> val3 = (EventHandler<ValueTuple<string, string>>)(
object)Delegate.Remove((Delegate)(object)val2, (Delegate)(object)value);
1264 while (val != val2);
1274 EventHandler<string> val2;
1278 EventHandler<string> val3 = (EventHandler<string>)(
object)Delegate.Combine((Delegate)(object)val2, (Delegate)(object)value);
1279 val = Interlocked.CompareExchange<EventHandler<string>>(ref this.
m_OnBuildError, val3, val2);
1281 while (val != val2);
1287 EventHandler<string> val2;
1291 EventHandler<string> val3 = (EventHandler<string>)(
object)Delegate.Remove((Delegate)(object)val2, (Delegate)(object)value);
1292 val = Interlocked.CompareExchange<EventHandler<string>>(ref this.
m_OnBuildError, val3, val2);
1294 while (val != val2);
1304 EventHandler<object> val2;
1308 EventHandler<object> val3 = (EventHandler<object>)(
object)Delegate.Combine((Delegate)(object)val2, (Delegate)(object)value);
1309 val = Interlocked.CompareExchange<EventHandler<object>>(ref this.
m_OnContentPreUpload, val3, val2);
1311 while (val != val2);
1317 EventHandler<object> val2;
1321 EventHandler<object> val3 = (EventHandler<object>)(
object)Delegate.Remove((Delegate)(object)val2, (Delegate)(object)value);
1322 val = Interlocked.CompareExchange<EventHandler<object>>(ref this.
m_OnContentPreUpload, val3, val2);
1324 while (val != val2);
1330 this.OnBuildStarted =
null;
1331 this.OnBuildProgress =
null;
1332 this.OnBuildSuccess =
null;
1333 this.OnBuildSuccessWithSignature =
null;
1334 this.OnBuildError =
null;
1339 this.OnContentPreUpload =
null;
1345 throw new NotImplementedException();
1351 throw new NotImplementedException();
1357 throw new NotImplementedException();
1360 [Obsolete(
"Use ExportSceneResource followed by VRC.SDKBase.Editor.Api.VRCApi methods instead")]
1363 Debug.LogError((
object)
"Uploading via the SDK builder is no longer supported, use ExportSceneResource followed by VRC.SDKBase.Editor.Api.VRCApi methods instead");
1366 [Obsolete(
"Use ExportSceneResource followed by VRC.SDKBase.Editor.Api.VRCApi methods instead")]
1369 Debug.LogError((
object)
"Uploading via the SDK builder is no longer supported, use ExportSceneResource followed by VRC.SDKBase.Editor.Api.VRCApi methods instead");
1374 string @
string = EditorPrefs.GetString(
"lastExternalPluginPath");
1375 string string2 = EditorPrefs.GetString(
"lastVRCPath");
1376 if (!String.IsNullOrEmpty(string2) && (String.IsNullOrEmpty(string2) || File.Exists(string2)))
1382 EditorUtility.DisplayDialog(
"Could not run VRChat scene",
"Last built VRChat scene could not be found. Please Test/Compile Full Scene (slow).",
"OK");
1422 if (onBuildStarted !=
null)
1424 onBuildStarted.Invoke((
object)
this, EventArgs.Empty);
1426 PipelineManager[] array = Object.FindObjectsOfType<PipelineManager>();
1427 if (array.Length != 0)
1429 PipelineManager val = array[0];
1431 if ((
int)VRC_SdkBuilder.ActiveBuildType == 2 && String.IsNullOrEmpty(val.blueprintId))
1435 if (buildAssetBundle)
1437 EditorPrefs.SetString(
"lastBuiltAssetBundleBlueprintID", val.blueprintId);
1439 EditorUtility.SetDirty((Object)(object)array[0]);
1440 EditorSceneManager.MarkSceneDirty(((Component)val).gameObject.scene);
1441 EditorSceneManager.SaveScene(((Component)val).gameObject.scene);
1449 }, [CompilerGenerated] (
object target) =>
1453 string @
string = EditorPrefs.GetString(
"currentBuildingAssetBundlePath");
1454 string string2 = EditorPrefs.GetString(
"currentBuildingAssetBundleWorldSignature");
1455 if (File.Exists(@
string))
1461 this.
OnBuildError?.Invoke((
object)
this,
"Failed to build the World. Check the logs for more details");
1463 catch (Exception val2)
1465 Exception val3 = val2;
1474 throw new NotImplementedException();
1480 throw new NotImplementedException();
1507 string text = Path.Join(String.op_Implicit(EditorApplication.applicationContentsPath), String.op_Implicit(
"PlaybackEngines/AndroidPlayer/SDK/platform-tools"));
1508 string text2 = (((int)Application.platform == 7) ?
"adb.exe" :
"adb");
1509 string text3 = Path.Join(String.op_Implicit(text), String.op_Implicit(text2));
1510 string result =
"adb";
1511 if (File.Exists(text3))
1518 public static ProcessStartInfo
GetAdbProcessInfo(Collection<string> arguments,
bool redirectStandardOutput =
true,
bool redirectStandardError =
true,
bool redirectStandardInput =
false)
1528 ProcessStartInfo val =
new ProcessStartInfo
1531 UseShellExecute =
false,
1532 CreateNoWindow =
true,
1533 RedirectStandardOutput = redirectStandardOutput,
1534 RedirectStandardError = redirectStandardError,
1535 RedirectStandardInput = redirectStandardInput
1537 IEnumerator<string> enumerator = arguments.GetEnumerator();
1540 while (((IEnumerator)enumerator).MoveNext())
1542 string current = enumerator.Current;
1543 val.ArgumentList.Add(current);
1549 if (enumerator !=
null)
1551 ((IDisposable)enumerator).Dispose();
1558 Process val = Process.Start(
GetAdbProcessInfo(
new Collection<string>((IList<string>)(
object)arguments)));
1560 string text = ((TextReader)val.StandardOutput).ReadToEnd();
1561 string text2 = ((TextReader)val.StandardError).ReadToEnd();
1562 if (val.ExitCode != 0)
1567 result.standardOut = text;
1568 result.standardError = text2;
1569 result.exitCode = val.ExitCode;
1575 Debug.Log((
object)String.Concat(
"ADB sync\n",
Command(
"shell",
"sync").standardOut));
1583 StringReader val =
new StringReader(adbResult.
standardOut);
1584 if (((TextReader)val).ReadLine().Trim() !=
"List of devices attached")
1588 List<string> val2 =
new List<string>();
1592 text = ((TextReader)val).ReadLine();
1593 if (!String.IsNullOrEmpty(text))
1598 while (!String.IsNullOrEmpty(text));
1602 public static void PushFile(
string localFilePath,
string remoteFilePath)
1604 Command(
"push", localFilePath, remoteFilePath);
1605 Debug.Log((
object)String.Concat(
"Pushed ", localFilePath,
" to ", remoteFilePath));
1610 Command(
"shell",
"mkdir",
"-p", dir);
1611 Debug.Log((
object)String.Concat(
"Created directory ", dir));
1614 public static void StartVRChat(
string remoteBundleFilePath,
string appPackageName)
1616 string text = ((!appPackageName.Contains(
"quest")) ? String.Concat(appPackageName,
"/com.vrchat.app.MainActivity") : String.Concat(appPackageName,
"/com.unity3d.player.UnityPlayerActivity"));
1617 Debug.Log((
object)String.Concat((
string[])(object)
new String[6] {
"Starting VRChat into world '", remoteBundleFilePath,
"'\\tActivity: ", text,
"\n\tlocalWorldPath: ", remoteBundleFilePath }));
1618 Debug.Log((
object)
Command(
"shell",
"am",
"start",
"-n", text,
"-a",
"android.intent.action.MAIN",
"-c",
"android.intent.category.LAUNCHER",
"-e",
"localWorldPath", remoteBundleFilePath,
"-e",
"watchWorlds",
"true").
standardOut);
1623 AdbResult adbResult =
Command(
"shell",
"ls", appPath,
">",
"/dev/null",
"2>&1",
"&&",
"echo",
"\"true\"",
"||",
"echo",
"\"false\"");
1637 return Command(
"shell",
"ls",
"/storage/emulated/0/Android/data/",
"|",
"grep",
"^com.vrchat").
standardOut.Trim().Split(
"\n", (StringSplitOptions)0);
1645 adbResult =
Command(
"shell",
"pidof", androidPackageName);
1655 if (String.IsNullOrEmpty(text))
1659 string[] array = text.Split(
" ", (StringSplitOptions)0);
1660 if (array.Length < 2)
1664 int num =
default(
int);
1665 if (!Int32.TryParse(array[0], ref num))
1669 if (!Int32.TryParse(array[1], ref num))
1679 return String.Concat(
"/storage/emulated/0/Android/data/", androidPackageName);
1685 return String.Concat(
"/storage/emulated/0/Android/data/", questPackageName);
1692 bool num = Environment.GetEnvironmentVariable(
"QA_SKIP_WINDOW_LOCK_CHECK", (EnvironmentVariableTarget)1) ==
"TRUE";
1693 bool flag = Environment.GetEnvironmentVariable(
"QA_SKIP_NFC_LOCK_CHECK", (EnvironmentVariableTarget)1) ==
"TRUE";
1694 List<Func<DeviceLockState>> val =
new List<Func<DeviceLockState>>();
1697 val.Add((Func<DeviceLockState>)GetDeviceWindowLockState);
1701 Debug.LogWarning((
object)
"QA: Skipping window based lock screen check");
1705 val.Add((Func<DeviceLockState>)GetDeviceNFCLockState);
1709 Debug.LogWarning((
object)
"QA: Skipping NFC based lock screen check");
1711 Enumerator<Func<DeviceLockState>> enumerator = val.GetEnumerator();
1714 while (enumerator.MoveNext())
1716 Func<DeviceLockState> current = enumerator.Current;
1720 if (deviceLockState != 0)
1722 return deviceLockState;
1732 ((IDisposable)enumerator).Dispose();
1738 IEnumerator<string> enumerator2 = Enumerable.Select<string,
string>((IEnumerable<string>)(
object)
Command(
"shell",
"dumpsys",
"nfc",
"|",
"grep",
"-e",
"'mScreenState='",
"-e",
"'Screen State:'").
standardOut.Trim().Split(
"\n", (StringSplitOptions)0), (Func<string, string>)((
string x) => x.Trim())).GetEnumerator();
1741 while (((IEnumerator)enumerator2).MoveNext())
1743 string current2 = enumerator2.Current;
1744 if (current2.EndsWith(
"UNLOCKED"))
1748 if (current2.EndsWith(
"LOCKED"))
1756 if (enumerator2 !=
null)
1758 ((IDisposable)enumerator2).Dispose();
1766 AdbResult adbResult =
Command(
"shell",
"dumpsys",
"window",
"|",
"grep",
"mDreamingLockscreen");
1767 if (adbResult.
standardOut.Trim().EndsWith(
"mDreamingLockscreen=false"))
1771 if (adbResult.
standardOut.Trim().EndsWith(
"mDreamingLockscreen=true"))
static List< string > GetDevices()
static bool AdbDirectoryExists(string appPath)
static void StartVRChat(string remoteBundleFilePath, string appPackageName)
static void PushFile(string localFilePath, string remoteFilePath)
static string[] GetPotentialVRChatAppPackages()
static string GetAndroidAppDataPath()
static AdbResult Command(params string[] arguments)
static void MakeDirectory(string dir)
static ProcessStartInfo GetAdbProcessInfo(Collection< string > arguments, bool redirectStandardOutput=true, bool redirectStandardError=true, bool redirectStandardInput=false)
static DeviceLockState GetDeviceLockState()
static string GetQuestAppDataPath()
static string GetAdbProcessFileName()
static bool IsAppOpen(string androidPackageName)
bool< FindDynamicContent > b__0(GameObject p)
List< GameObject > prefabs
void FinishExportCurrentSceneResourceWithPlugin()
static void FindDynamicContent(VRC_SceneDescriptor desc)
static void RunWorldTestAndroid(string bundleFilePath)
void ExportCurrentSceneResource()
static void LaunchSceneBlueprintUploader()
static List< string > GetAndroidDevices()
static void RunScene(string bundleFilePath, string pluginFilePath)
static void RunWorldTestDesktop(string bundleFilePath, string pluginFilePath)
static void RunExportedSceneResourceAndCleanupPlugin()
static void AndroidCleanupOldTestWorlds(string appPath)
static void RunExportedSceneResource()
void ExportCurrentSceneResource(bool buildAssetBundle=true, Action< string > onProgress=null, Action< object > onContentProcessed=null)
void ExportAndUploadSceneBlueprint()
EventHandler< string > m_OnBuildProgress
bool ExportSceneResourceInternal(bool buildAssetBundle=true)
void ClearUploadEventHandlers()
EventHandler< string > OnBuildSuccess
EventHandler< string > OnBuildError
void UploadLastExportedSceneBlueprint()
bool ExportAndTestAvatarBlueprint(GameObject externalReference=null)
EventHandler< object > m_OnBuildContentProcessed
EventHandler< ValueTuple< string, string > > m_OnBuildSuccessWithSignature
EventHandler< string > m_OnBuildSuccess
EventHandler< string > m_OnBuildError
bool ExportAvatarBlueprint(GameObject externalReference=null)
EventHandler< string > OnBuildProgress
EventHandler< object > m_OnContentPreUpload
void ExportAvatarToV3(GameObject externalReference=null)
void ClearEventHandlers()
EventHandler m_OnBuildStarted
bool ExportAndUploadAvatarBlueprint(GameObject externalReference=null)
void ExportSceneResourceAndRun()
EventHandler< object > OnBuildContentProcessed
EventHandler< object > OnContentPreUpload
EventHandler OnBuildStarted
bool ExportSceneResource()
void RunLastExportedSceneResource()
EventHandler< ValueTuple< string, string > > OnBuildSuccessWithSignature
static void ClearAssemblyReloadCallbacks()
static void AddOnAssemblyReloadCallback(string className, string staticFunctionName, bool autoSerialize=true)
override void OnGUI(Rect _position, SerializedProperty _property, GUIContent _label)
AdbException(int exitCode, string stdOut, string stdError)
AndroidTestBuildException(string message, Exception innerException)
AndroidTestBuildException(string message)
WorldAssetExportException(string message, Exception innerException)
WorldAssetExportException(string message)
static bool HasParentWithComponent(Transform target, out string existingPlayerObjectParent)
override VisualElement CreateInspectorGUI()
static bool HasChildWithComponent(Transform target, out string existingPlayerObjectChild)
void RemoveNestedPlayerObjectComponents()
override VisualElement CreateInspectorGUI()
HelpBoxVisualElement(string message, HelpBoxMessageType messageType)
override void OnImportAsset(AssetImportContext ctx)
MidiImportSettings ImportSettings
static MidiFile Create(string filePath, MidiImportSettings midiImportSettings)
static void FindDynamicContent(ref List< GameObject > prefabs, ref List< Material > materials)
static void DoPreExportShaderReplacement()
static void CleanupTmpFiles()
static bool OnPreprocessScene(Scene scene)
static void OnPostprocessScene(Scene scene)
static string QuestPackageName
static string AndroidPackageName
static string GetLocalLowPath()
List< GameObject > DynamicPrefabs