2using System.Collections;
3using System.Collections.Generic;
4using System.Diagnostics;
7using System.Reflection;
8using System.Runtime.CompilerServices;
9using System.Runtime.InteropServices;
10using System.Runtime.Versioning;
11using JetBrains.Annotations;
13using UnityEditor.Build;
14using UnityEditor.Build.Reporting;
15using UnityEditor.Callbacks;
16using UnityEditor.SceneManagement;
18using UnityEngine.Networking;
19using UnityEngine.Rendering;
20using UnityEngine.SceneManagement;
21using UnityEngine.UIElements;
30[assembly: CompilationRelaxations(8)]
31[assembly: RuntimeCompatibility(WrapNonExceptionThrows =
true)]
32[assembly: Debuggable()]
33[assembly: InternalsVisibleTo(
"VRC.SDK3A.Editor")]
34[assembly: InternalsVisibleTo(
"VRC.SDK3.Editor")]
35[assembly: InternalsVisibleTo(
"VRCEconomy-Editor")]
36[assembly: InternalsVisibleTo(
"VRCSDKBase-Editor")]
37[assembly: InternalsVisibleTo(
"VRCSDK3-Editor")]
38[assembly: UnityAPICompatibilityVersion(
"2022.3.22f1",
true)]
39[assembly: TargetFramework(
".NETStandard,Version=v2.1", FrameworkDisplayName =
".NET Standard 2.1")]
40[assembly: AssemblyCompany(
"VRCSDKBase-Editor")]
41[assembly: AssemblyConfiguration(
"Release")]
42[assembly: AssemblyFileVersion(
"1.0.0.0")]
43[assembly: AssemblyInformationalVersion(
"1.0.0+77370df7b4055abf7cc0fb1da3c3d290108e9941")]
44[assembly: AssemblyProduct(
"VRCSDKBase-Editor")]
45[assembly: AssemblyTitle(
"VRCSDKBase-Editor")]
46[assembly: AssemblyVersion(
"1.0.0.0")]
58 throw new ApplicationException(String.Format(
"Failed to assign network IDs, {0} errors encountered!", (
object)errors.Count));
71 GameObject[] rootGameObjects = ((Scene)(ref scene)).GetRootGameObjects();
72 for (
int i = 0; i < rootGameObjects.Length; i++)
75 if ((Object)(object)vRC_SceneDescriptor != (Object)
null)
80 if ((Object)(object)vRC_SceneDescriptor == (Object)
null)
82 Logger.LogError(
"Unable to find scene descriptor in scene");
89 Logger.LogError(String.Format(
"Failed to assign network IDs, {0} errors encountered!\nTry using the Network ID Utility to resolve them.", (
object)errors.Count));
94 ((Object)(
object)vRC_SceneDescriptor).MarkDirty();
95 PrefabUtility.RecordPrefabInstancePropertyModifications((Object)(object)vRC_SceneDescriptor);
96 AssetDatabase.SaveAssets();
110 while (((IEnumerator)enumerator).MoveNext())
112 if (!enumerator.Current.OnPreprocess())
120 if (enumerator !=
null)
122 ((IDisposable)enumerator).Dispose();
134 Transform[] componentsInChildren = avatarGameObject.GetComponentsInChildren<Transform>(
true);
135 for (
int num = componentsInChildren.Length - 1; num > -1; num--)
137 if (((Component)componentsInChildren[num]).CompareTag(
"EditorOnly"))
139 Object.DestroyImmediate((Object)(object)((Component)componentsInChildren[num]).gameObject);
143 for (
int num2 = componentsInChildren2.Length - 1; num2 > -1; num2--)
146 Object.DestroyImmediate((Object)((obj is Component) ? obj :
null));
156 public static void SetColor(Color color,
float alpha)
163 Gizmos.color =
new Color(color.r, color.g, color.b, color.a * alpha);
166 public static void DrawWireCube(Vector3 center, Vector3 size, Quaternion rotation =
default(Quaternion))
179 Matrix4x4 matrix = Gizmos.matrix;
180 if (((Quaternion)(ref rotation)).Equals(
default(Quaternion)))
182 rotation = Quaternion.identity;
184 Gizmos.matrix = Matrix4x4.TRS(center, rotation, size);
185 Gizmos.DrawWireCube(Vector3.zero, Vector3.one);
186 Gizmos.matrix = matrix;
189 public static void DrawArrow(Vector3 from, Vector3 to,
float arrowHeadLength = 0.25f,
float arrowHeadAngle = 20f)
219 Gizmos.DrawLine(from, to);
220 Vector3 val = to - from;
221 Vector3 val2 = Quaternion.LookRotation(val) * Quaternion.Euler(0f, 180f + arrowHeadAngle, 0f) *
new Vector3(0f, 0f, 1f);
222 Vector3 val3 = Quaternion.LookRotation(val) * Quaternion.Euler(0f, 180f - arrowHeadAngle, 0f) *
new Vector3(0f, 0f, 1f);
223 Gizmos.DrawLine(to, to + val2 * arrowHeadLength);
224 Gizmos.DrawLine(to, to + val3 * arrowHeadLength);
227 public static void DrawWireSphere(Vector3 center,
float radius, Quaternion rotation =
default(Quaternion))
239 Matrix4x4 matrix = Gizmos.matrix;
240 if (((Quaternion)(ref rotation)).Equals(
default(Quaternion)))
242 rotation = Quaternion.identity;
244 Gizmos.matrix = Matrix4x4.TRS(center, rotation, Vector3.one);
245 Gizmos.DrawWireSphere(Vector3.zero, radius);
246 Gizmos.matrix = matrix;
249 public static void DrawWireCircle(Vector3 center,
float radius,
int segments = 20, Quaternion rotation =
default(Quaternion))
253 DrawWireArc(center, radius, 360f, segments, rotation);
256 public static void DrawWireArc(Vector3 center,
float radius,
float angle,
int segments = 20, Quaternion rotation =
default(Quaternion))
272 Matrix4x4 matrix = Gizmos.matrix;
273 Gizmos.matrix = Matrix4x4.TRS(center, rotation, Vector3.one);
274 Vector3 val = Vector3.forward * radius;
275 int num = Mathf.RoundToInt(angle / (
float)segments);
276 Vector3 val2 =
default(Vector3);
277 for (
int i = 0; (float)i <= angle; i += num)
279 ((Vector3)(ref val2))..ctor(radius * Mathf.Sin((
float)i * ((float)Math.PI / 180f)), 0f, radius * Mathf.Cos((
float)i * ((float)Math.PI / 180f)));
280 Gizmos.DrawLine(val, val2);
283 Gizmos.matrix = matrix;
286 public static void DrawWireArc(Vector3 center,
float radius,
float angle,
int segments, Quaternion rotation, Vector3 centerOfRotation)
316 Matrix4x4 matrix = Gizmos.matrix;
317 if (((Quaternion)(ref rotation)).Equals(
default(Quaternion)))
319 rotation = Quaternion.identity;
321 Gizmos.matrix = Matrix4x4.TRS(centerOfRotation, rotation, Vector3.one);
322 Vector3 val = centerOfRotation - center;
323 Vector3 val2 = val + Vector3.forward * radius;
324 int num = Mathf.RoundToInt(angle / (
float)segments);
325 for (
int i = 0; (float)i <= angle; i += num)
327 Vector3 val3 =
new Vector3(radius * Mathf.Sin((
float)i * ((
float)Math.PI / 180f)), 0f, radius * Mathf.Cos((
float)i * ((
float)Math.PI / 180f))) + val;
328 Gizmos.DrawLine(val2, val3);
331 Gizmos.matrix = matrix;
334 public static void DrawWireArc(Matrix4x4 matrix,
float radius,
float angle,
int segments)
347 Matrix4x4 matrix2 = Gizmos.matrix;
348 Gizmos.matrix = matrix;
349 Vector3 val = Vector3.forward * radius;
350 int num = Mathf.RoundToInt(angle / (
float)segments);
351 Vector3 val2 =
default(Vector3);
352 for (
int i = 0; (float)i <= angle; i += num)
354 ((Vector3)(ref val2))..ctor(radius * Mathf.Sin((
float)i * ((float)Math.PI / 180f)), 0f, radius * Mathf.Cos((
float)i * ((float)Math.PI / 180f)));
355 Gizmos.DrawLine(val, val2);
358 Gizmos.matrix = matrix2;
361 public static void DrawWireCylinder(Vector3 center,
float radius,
float height, Quaternion rotation =
default(Quaternion))
428 Matrix4x4 matrix = Gizmos.matrix;
429 if (((Quaternion)(ref rotation)).Equals(
default(Quaternion)))
431 rotation = Quaternion.identity;
433 Gizmos.matrix = Matrix4x4.TRS(center, rotation, Vector3.one);
434 float num = height / 2f;
435 Gizmos.DrawLine(Vector3.right * radius - Vector3.up * num, Vector3.right * radius + Vector3.up * num);
436 Gizmos.DrawLine(-Vector3.right * radius - Vector3.up * num, -Vector3.right * radius + Vector3.up * num);
437 Gizmos.DrawLine(Vector3.forward * radius - Vector3.up * num, Vector3.forward * radius + Vector3.up * num);
438 Gizmos.DrawLine(-Vector3.forward * radius - Vector3.up * num, -Vector3.forward * radius + Vector3.up * num);
439 DrawWireArc(center + Vector3.up * num, radius, 360f, 20, rotation, center);
440 DrawWireArc(center + Vector3.down * num, radius, 360f, 20, rotation, center);
441 Gizmos.matrix = matrix;
444 public static void DrawWireCylinder(Vector3 center,
float height,
float radius1,
float radius2, Quaternion rotation =
default(Quaternion))
511 Matrix4x4 matrix = Gizmos.matrix;
512 if (((Quaternion)(ref rotation)).Equals(
default(Quaternion)))
514 rotation = Quaternion.identity;
516 Gizmos.matrix = Matrix4x4.TRS(center, rotation, Vector3.one);
517 float num = height / 2f;
518 Gizmos.DrawLine(Vector3.right * radius1 - Vector3.up * num, Vector3.right * radius2 + Vector3.up * num);
519 Gizmos.DrawLine(-Vector3.right * radius1 - Vector3.up * num, -Vector3.right * radius2 + Vector3.up * num);
520 Gizmos.DrawLine(Vector3.forward * radius1 - Vector3.up * num, Vector3.forward * radius2 + Vector3.up * num);
521 Gizmos.DrawLine(-Vector3.forward * radius1 - Vector3.up * num, -Vector3.forward * radius2 + Vector3.up * num);
522 DrawWireArc(center + Vector3.up * num, radius1, 360f, 20, rotation, center);
523 DrawWireArc(center + Vector3.down * num, radius2, 360f, 20, rotation, center);
524 Gizmos.matrix = matrix;
527 public static void DrawWireCapsule(Vector3 center,
float radius,
float height, Quaternion rotation =
default(Quaternion))
544 if (((Quaternion)(ref rotation)).Equals(
default(Quaternion)))
546 rotation = Quaternion.identity;
548 Matrix4x4 matrix = Gizmos.matrix;
549 Gizmos.matrix = Matrix4x4.TRS(center, rotation, Vector3.one);
550 float num = Mathf.Max(0f, height * 0.5f - radius);
554 Gizmos.matrix = matrix;
589 Vector3 val = (isUp ? Vector3.up : Vector3.down);
590 Quaternion val2 = (isUp ? Quaternion.AngleAxis(90f, Vector3.forward) : Quaternion.AngleAxis(-90f, Vector3.forward));
591 center += rotation * val * half;
592 DrawWireArc(Matrix4x4.TRS(center, rotation * val2, Vector3.one), radius, 180f, 20);
593 DrawWireArc(Matrix4x4.TRS(center, rotation * Quaternion.AngleAxis(90f, val) * val2, Vector3.one), radius, 180f, 20);
596 public static void DrawWireCapsule(Vector3 point1, Vector3 point2,
float radius1,
float radius2)
613 Vector3 center = (point1 + point2) * 0.5f;
614 float height = Vector3.Distance(point1, point2);
615 Vector3 up = Vector3.up;
616 Vector3 val = point2 - point1;
617 Quaternion rotation = Quaternion.FromToRotation(up, ((Vector3)(ref val)).normalized);
621 public static void DrawWireCapsule(Vector3 center, Quaternion rotation,
float height,
float radius1,
float radius2)
634 public static void DrawWireSquare(Vector3 center, Quaternion rotation, Vector2 size)
688 Vector3 val = rotation * Vector3.right * size.x;
689 Vector3 val2 = rotation * Vector3.forward * size.y;
690 Gizmos.DrawLine(center - val - val2, center + val - val2);
691 Gizmos.DrawLine(center + val - val2, center + val + val2);
692 Gizmos.DrawLine(center + val + val2, center - val + val2);
693 Gizmos.DrawLine(center - val + val2, center - val - val2);
696 public static void DrawWirePlane(Vector3 center, Quaternion rotation,
float size)
712 Vector3 val = rotation * Vector3.up;
713 Gizmos.DrawLine(center, center + val * size);
716 public static void DrawWireCone(Vector3 tip, Quaternion rotation,
float height,
float radius)
735 Vector3 val =
default(Vector3);
736 ((Vector3)(ref val))..ctor(radius, height, 0f);
737 for (
int i = 0; i < 12; i++)
739 Vector3 val2 = Quaternion.AngleAxis((
float)i / 12f * 360f, Vector3.up) * val;
740 Gizmos.DrawLine(tip, tip + rotation * val2);
742 DrawWireCircle(tip + rotation *
new Vector3(0f, height, 0f), radius, 20, rotation);
745 public static void DrawWireAngleCone(Vector3 tip, Quaternion rotation,
float radius,
float angle,
int segments = 12)
771 Vector3 val = Quaternion.AngleAxis(angle, Vector3.forward) *
new Vector3(0f, radius, 0f);
772 for (
int i = 0; i < segments; i++)
774 Vector3 val2 = Quaternion.AngleAxis((
float)i / (
float)segments * 360f, Vector3.up) * val;
775 Gizmos.DrawLine(tip, tip + rotation * val2);
777 DrawWireCircle(tip + rotation *
new Vector3(0f, val.y, 0f), val.x, 20, rotation);
796 private static List<Quaternion> _capsuleGizmoRotations;
798 private static List<Quaternion> _sphereGizmoRotations;
800 private static MethodInfo _applyWireMaterialMethod;
822 if (_capsuleGizmoRotations !=
null)
824 return _capsuleGizmoRotations;
826 Vector3[] array = (Vector3[])(
object)
new Vector3[6]
835 Single[] array2 =
new Single[6];
836 RuntimeHelpers.InitializeArray((Array)(object)array2, (RuntimeFieldHandle));
837 float[] array3 = (
float[])(
object)array2;
838 _capsuleGizmoRotations =
new List<Quaternion>();
840 for (
int i = 0; i < 6; i++)
842 Vector3 val = array[i];
843 float num2 = array3[i];
844 for (
int j = 0; j < 13; j++)
846 _capsuleGizmoRotations.Add(Quaternion.AngleAxis(num * (
float)j + num2, val));
849 return _capsuleGizmoRotations;
867 if (_sphereGizmoRotations !=
null)
869 return _sphereGizmoRotations;
871 if (_sphereGizmoRotations ==
null)
873 Vector3[] array = (Vector3[])(
object)
new Vector3[3]
879 _sphereGizmoRotations =
new List<Quaternion>();
881 for (
int i = 0; i < 3; i++)
883 Vector3 val = array[i];
884 for (
int j = 0; j < 25; j++)
886 _sphereGizmoRotations.Add(Quaternion.AngleAxis(num * (
float)j, val));
890 return _sphereGizmoRotations;
894 public static void SetColor(Color color,
float alpha)
901 Handles.color =
new Color(color.r, color.g, color.b, color.a * alpha);
915 Handles.DrawWireArc(center, Vector3.up, Vector3.forward, 360f, radius);
916 Handles.DrawWireArc(center, Vector3.forward, Vector3.up, 360f, radius);
917 Handles.DrawWireArc(center, Vector3.right, Vector3.up, 360f, radius);
920 public static void DrawWireSphere(Vector3 center, Quaternion rotation,
float radius)
943 Handles.DrawWireArc(center, rotation * Vector3.up, rotation * Vector3.forward, 360f, radius);
944 Handles.DrawWireArc(center, rotation * Vector3.forward, rotation * Vector3.up, 360f, radius);
945 Handles.DrawWireArc(center, rotation * Vector3.right, rotation * Vector3.up, 360f, radius);
948 public static void DrawWireCylinder(Vector3 center,
float height,
float radius1,
float radius2, Quaternion rotation =
default(Quaternion),
int segments = 8)
988 Matrix4x4 matrix = Handles.matrix;
989 if (((Quaternion)(ref rotation)).Equals(
default(Quaternion)))
991 rotation = Quaternion.identity;
993 Handles.matrix = Matrix4x4.TRS(center, rotation, Vector3.one);
994 float num = height / 2f;
995 Vector3 val = Vector3.right * radius1 - Vector3.up * num;
996 Vector3 val2 = Vector3.right * radius2 + Vector3.up * num;
997 for (
int i = 0; i < segments; i++)
999 Quaternion val3 = Quaternion.AngleAxis((
float)i / (
float)segments * 360f, Vector3.up);
1000 Handles.DrawLine(val3 * val, val3 * val2);
1002 Handles.DrawWireDisc(Vector3.down * num, Vector3.up, radius1);
1003 Handles.DrawWireDisc(Vector3.up * num, Vector3.up, radius2);
1004 Handles.matrix = matrix;
1007 public static void DrawWireCapsule(Vector3 center, Quaternion rotation,
float height,
float radius)
1081 if (height <= radius * 2f)
1086 Vector3 val = rotation * Vector3.up * (height * 0.5f - radius);
1087 Vector3 val2 = rotation * Vector3.right * radius;
1088 Vector3 val3 = rotation * Vector3.forward * radius;
1089 Vector3 normalized = ((Vector3)(ref val)).normalized;
1090 Vector3 val4 = center - val;
1091 Vector3 val5 = center + val;
1092 Handles.DrawLine(val4 + val2, val5 + val2);
1093 Handles.DrawLine(val4 - val2, val5 - val2);
1094 Handles.DrawLine(val4 + val3, val5 + val3);
1095 Handles.DrawLine(val4 - val3, val5 - val3);
1096 val2 = ((Vector3)(ref val2)).normalized;
1097 val3 = ((Vector3)(ref val3)).normalized;
1098 Handles.DrawWireDisc(val4, -normalized, radius);
1099 Handles.DrawWireArc(val4, val2, val3, 180f, radius);
1100 Handles.DrawWireArc(val4, val3, -val2, 180f, radius);
1101 Handles.DrawWireDisc(val5, normalized, radius);
1102 Handles.DrawWireArc(val5, val2, -val3, 180f, radius);
1103 Handles.DrawWireArc(val5, val3, val2, 180f, radius);
1106 public static void DrawWireCapsule(Vector3 center, Quaternion rotation,
float height,
float radius1,
float radius2)
1145 Vector3 val = (isUp ? Vector3.up : Vector3.down);
1146 float num = (isUp ? 180f : (-180f));
1147 center += rotation * val * half;
1148 Handles.DrawWireArc(center, rotation * Vector3.forward, rotation * Vector3.right, num, radius);
1149 Handles.DrawWireArc(center, rotation * Vector3.left, rotation * Vector3.forward, num, radius);
1152 public static void DrawWireAngleCone(Vector3 tip, Quaternion rotation,
float radius,
float angle,
int segments = 12)
1180 Vector3 val = Quaternion.AngleAxis(angle, Vector3.forward) *
new Vector3(0f, radius, 0f);
1181 for (
int i = 0; i < segments; i++)
1183 Vector3 val2 = Quaternion.AngleAxis((
float)i / (
float)segments * 360f, Vector3.up) * val;
1184 Handles.DrawLine(tip, tip + rotation * val2);
1186 Handles.DrawWireDisc(tip + rotation *
new Vector3(0f, val.y, 0f), rotation * Vector3.up, val.x);
1205 Vector3 val = rotation * Vector3.up;
1206 Vector3 val2 = rotation * Quaternion.AngleAxis(angle, Vector3.forward) * Vector3.up;
1207 Handles.DrawSolidArc(tip, val, val2, 360f, radius);
1262 Vector3 val = rotation * Vector3.right * size;
1263 Vector3 val2 = rotation * Vector3.forward * size;
1264 Handles.DrawLine(center - val - val2, center + val - val2);
1265 Handles.DrawLine(center + val - val2, center + val + val2);
1266 Handles.DrawLine(center + val + val2, center - val + val2);
1267 Handles.DrawLine(center - val + val2, center - val - val2);
1336 Vector3 val = Vector3.Cross(normal, Mathf.Approximately(normal.y, 1f) ? Vector3.forward : Vector3.up);
1337 Vector3 val2 = Vector3.Cross(normal, val);
1338 Vector3 normalized = ((Vector3)(ref val2)).normalized;
1339 val2 = Vector3.Cross(normal, normalized);
1340 Vector3 normalized2 = ((Vector3)(ref val2)).normalized;
1342 normalized2 *= size;
1343 Handles.DrawLine(center - normalized - normalized2, center + normalized - normalized2);
1344 Handles.DrawLine(center + normalized - normalized2, center + normalized + normalized2);
1345 Handles.DrawLine(center + normalized + normalized2, center - normalized + normalized2);
1346 Handles.DrawLine(center - normalized + normalized2, center - normalized - normalized2);
1359 Handles.DrawLine(center, center + normal * size);
1362 public static int AddLineToBatch(ref List<Vector3> buffer, Vector3 start, Vector3 end)
1371 public static int AddCapsuleToBatch(ref List<Vector3> buffer,
float beginRadius,
float endRadius,
float half)
1399 Vector3 val = Vector3.right * beginRadius - Vector3.up * half;
1400 Vector3 val2 = Vector3.right * endRadius + Vector3.up * half;
1401 for (
int i = 0; i < 4; i++)
1403 Quaternion val3 = Quaternion.AngleAxis((
float)i / 4f * 360f, Vector3.up);
1404 buffer.Add(val3 * val);
1405 buffer.Add(val3 * val2);
1426 for (
int i = 0; i < 25; i++)
1430 for (
int j = 0; j < 25; j++)
1437 private static int AddCapsuleCapPoints(ref List<Vector3> buffer,
float beginRadius,
float endRadius,
float half)
1467 for (
int i = 0; i < 13; i++)
1471 for (
int j = 0; j < 13; j++)
1475 for (
int k = 0; k < 13; k++)
1479 for (
int l = 0; l < 13; l++)
1500 for (
int i = 0; i < 25; i++)
1504 for (
int j = 0; j < 25; j++)
1508 for (
int k = 0; k < 25; k++)
1522 GL.MultMatrix(Matrix4x4.identity);
1525 GL.Vertex(buffer[offset]);
1526 GL.Vertex(buffer[offset + 1]);
1532 public static int DrawSphereBatched(ref List<Vector3> buffer,
int offset, Color color, Matrix4x4 matrix)
1542 GL.MultMatrix(matrix);
1545 for (
int i = 0; i < 25; i++)
1547 GL.Vertex(buffer[offset + i]);
1553 for (
int j = 0; j < 25; j++)
1555 GL.Vertex(buffer[offset + j]);
1561 for (
int k = 0; k < 25; k++)
1563 GL.Vertex(buffer[offset + k]);
1571 public static int DrawCapsuleBatched(ref List<Vector3> buffer,
int offset, Color color, Matrix4x4 matrix)
1590 GL.MultMatrix(matrix);
1591 for (
int i = 0; i < 8; i += 2)
1595 GL.Vertex(buffer[offset + i]);
1596 GL.Vertex(buffer[offset + i + 1]);
1602 for (
int j = 0; j < 25; j++)
1604 GL.Vertex(buffer[offset + j]);
1610 for (
int k = 0; k < 25; k++)
1612 GL.Vertex(buffer[offset + k]);
1618 for (
int l = 0; l < 13; l++)
1620 GL.Vertex(buffer[offset + l]);
1626 for (
int m = 0; m < 13; m++)
1628 GL.Vertex(buffer[offset + m]);
1634 for (
int n = 0; n < 13; n++)
1636 GL.Vertex(buffer[offset + n]);
1642 for (
int num = 0; num < 13; num++)
1644 GL.Vertex(buffer[offset + num]);
1655 if (_applyWireMaterialMethod == (MethodInfo)
null)
1657 _applyWireMaterialMethod = typeof(HandleUtility).GetMethod(
"ApplyWireMaterial", (BindingFlags)40, (Binder)
null, (Type[])(
object)
new Type[1] { typeof(CompareFunction) }, (ParameterModifier[])
null);
1659 MethodInfo applyWireMaterialMethod = _applyWireMaterialMethod;
1660 if (applyWireMaterialMethod !=
null)
1662 ((MethodBase)applyWireMaterialMethod).Invoke((
object)
null, (
object[])(
object)
new Object[1] { (object)Handles.zTest });
1694 EditorGUI.BeginChangeCheck();
1695 Quaternion quaternionValue =
property.quaternionValue;
1696 Vector3 val = EditorGUILayout.Vector3Field(
"Rotation", ((Quaternion)(ref quaternionValue)).eulerAngles, Array.Empty<GUILayoutOption>());
1697 if (EditorGUI.EndChangeCheck())
1699 property.quaternionValue = Quaternion.Euler(val);
1728 Texture2D val =
new Texture2D(1, 1);
1729 val.SetPixel(0, 0, color);
1742 EditorGUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
1744 if (GUILayout.Button(
"Add", Array.Empty<GUILayoutOption>()))
1746 data.
array.InsertArrayElementAtIndex(data.
array.arraySize);
1749 EditorGUI.EndDisabledGroup();
1750 EditorGUI.BeginDisabledGroup(selected < 0);
1751 if (GUILayout.Button(
"Up", Array.Empty<GUILayoutOption>()) && selected > 0)
1753 data.
array.MoveArrayElement(selected, selected - 1);
1757 if (GUILayout.Button(
"Down", Array.Empty<GUILayoutOption>()) && selected < data.
array.arraySize - 1)
1759 data.
array.MoveArrayElement(selected, selected + 1);
1763 if (GUILayout.Button(
"Delete", Array.Empty<GUILayoutOption>()))
1765 data.
array.DeleteArrayElementAtIndex(selected);
1769 EditorGUI.EndDisabledGroup();
1770 EditorGUILayout.EndHorizontal();
1771 for (
int i = 0; i < data.
array.arraySize; i++)
1773 bool num = i == selected;
1774 EditorGUI.BeginChangeCheck();
1777 EditorGUILayout.EndVertical();
1778 if (EditorGUI.EndChangeCheck())
1783 if ((
int)Event.current.type == 0 && ((Rect)(ref val)).Contains(Event.current.mousePosition))
1794 Event.current.Use();
1828 return sf.className == className;
1834 public static string SERIALIZATION_PATH = String.Concat(Application.dataPath,
"/../vrcAssemblyCallbacks");
1836 public static string TMP_FILE_PATH = String.Concat(Application.dataPath,
"/VRCSDK/_tmp.cs");
1849 Logger.Log(
"Reloading Assemblies", DebugLevel.All);
1850 EditorApplication.delayCall = (CallbackFunction)Delegate.Combine((Delegate)(object)EditorApplication.delayCall, (Delegate)
new CallbackFunction(
DoIt));
1863 AssetDatabase.Refresh();
1884 while ((text = ((TextReader)val).ReadLine()) !=
null)
1886 string[] array = text.Split((
char[])(
object)
new Char[1] { (Char)44 });
1889 ((TextReader)val).Close();
1907 while (enumerator.MoveNext())
1915 ((IDisposable)enumerator).Dispose();
1923 ((IDisposable)val).Dispose();
1931 CS$<>8__locals0.staticFunctionName = staticFunctionName;
1932 CS$<>8__locals0.className = className;
1963 if (onAssemblyReloadCallbacks ==
null)
1967 Enumerator<SerializableFunction> enumerator = onAssemblyReloadCallbacks.GetEnumerator();
1970 while (enumerator.MoveNext())
1975 ((MethodBase)Assembly.GetExecutingAssembly().GetType(current.
className).GetMethod(current.
methodName, (BindingFlags)24)).Invoke((
object)
null, (
object[])
null);
1977 catch (Exception val)
1979 Exception val2 = val;
1980 Debug.Log((
object)String.Concat((
string[])(object)
new String[6] {
"Error calling ", current.
className,
".", current.
methodName,
" - ", val2.Message }));
1986 ((IDisposable)enumerator).Dispose();
1992 List<string> val =
new List<string>();
1993 Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies();
1994 for (
int i = 0; i < assemblies.Length; i++)
1996 string name = assemblies[i].GetName().Name;
2004 return Enumerable.ToList<
string>(Enumerable.Where<
string>((IEnumerable<string>)(
object)
GetLoadedAssemblies(), (Func<string, bool>)((
string a) => a.StartsWith(
"vrc"))));
2028 Scene activeScene = SceneManager.GetActiveScene();
2029 string path = ((Scene)(ref activeScene)).path;
2030 List<string> obj =
new List<string>();
2037 Logger.Log(String.Concat(
"Exporting package to: ", dstPath), DebugLevel.All);
2038 EditorUtility.DisplayProgressBar(
"Exporting unity package",
"Future proofing your content!", 1f);
2039 Logger.Log(String.Concat(
"Exporting to ", dstPath), DebugLevel.All);
2040 if (!assetPaths.Contains(
"Assets/VRCSDK"))
2042 assetPaths.Add(
"Assets/VRCSDK");
2044 EditorPrefs.SetString(
"VRC_exportedUnityPackagePath", dstPath);
2045 AssetDatabase.ExportPackage(assetPaths.ToArray(), dstPath, (ExportPackageOptions)14);
2046 EditorUtility.ClearProgressBar();
2051 EditorPrefs.DeleteKey(
"VRC_exportedUnityPackagePath");
2058 Scene activeScene = SceneManager.GetActiveScene();
2059 string fileNameWithoutExtension = Path.GetFileNameWithoutExtension(((Scene)(ref activeScene)).path);
2060 return String.Concat(Path.GetDirectoryName(Application.dataPath), ((Char)(ref Path.DirectorySeparatorChar)).ToString(), fileNameWithoutExtension,
".unitypackage");
2067 List<GameObject> prefabs2 =
new List<GameObject>();
2077 Renderer[] array = Object.FindObjectsOfType<Renderer>();
2078 Shader val = Shader.Find(
"VRChat/Sprites/Default");
2079 Shader val2 = Shader.Find(
"VRChat/Sprites/Diffuse");
2080 if (!Object.op_Implicit((Object)(
object)val) && !Object.op_Implicit((Object)(
object)val2))
2084 Renderer[] array2 = array;
2085 for (
int i = 0; i < array2.Length; i++)
2087 Material[] sharedMaterials = array2[i].sharedMaterials;
2088 foreach (Material val3
in sharedMaterials)
2090 if ((Object)(object)val3 == (Object)
null)
2094 Shader shader = val3.shader;
2095 if (Object.op_Implicit((Object)(object)val) && ((Object)shader).name ==
"Sprites/Default")
2101 if (!Object.op_Implicit((Object)(object)val2) || !(((Object)shader).name ==
"Sprites/Diffuse"))
2107 val3.shader = shader;
2116 SerializedObject val =
new SerializedObject(AssetDatabase.LoadAllAssetsAtPath(
"ProjectSettings/GraphicsSettings.asset")[0]);
2118 SerializedProperty val2 = val.FindProperty(
"m_AlwaysIncludedShaders");
2119 List<Shader> val3 = Enumerable.ToList<Shader>(Enumerable.Where<Shader>(shaders, (Func<Shader, bool>)((Shader s) => (Object)(
object)s != (Object)
null && !((Object)s).name.Contains(
"Standard"))));
2120 for (
int i = 0; i < val2.arraySize; i++)
2122 Object objectReferenceValue = val2.GetArrayElementAtIndex(i).objectReferenceValue;
2123 Shader val4 = (Shader)(
object)((objectReferenceValue is Shader) ? objectReferenceValue :
null);
2124 if ((Object)(object)val4 != (Object)
null && val3.Contains(val4))
2129 int arraySize = val2.arraySize;
2132 val2.arraySize += val3.Count;
2135 for (
int j = arraySize; j < val2.arraySize; j++)
2137 Debug.LogFormat(
"Adding {0} to Always Included Shaders", (
object[])(object)
new Object[1] { (Object)((Object)val3[j - arraySize]).name });
2138 val2.GetArrayElementAtIndex(j).objectReferenceValue = (Object)(
object)val3[j - arraySize];
2142 val.ApplyModifiedProperties();
2148 FindMaterialsOnObjects((IEnumerable<GameObject>)(
object)Object.FindObjectsOfType<GameObject>(), ref prefabs, ref materials);
2151 private static void FindMaterialsOnObjects(IEnumerable<GameObject> objs, ref List<GameObject> prefabs, ref List<Material> materials)
2153 IEnumerator<GameObject> enumerator = objs.GetEnumerator();
2156 while (((IEnumerator)enumerator).MoveNext())
2158 GameObject current = enumerator.Current;
2159 if ((Object)(
object)current == (Object)
null)
2163 Renderer[] componentsInChildren = current.GetComponentsInChildren<Renderer>();
2164 for (
int i = 0; i < componentsInChildren.Length; i++)
2166 Material[] sharedMaterials = componentsInChildren[i].sharedMaterials;
2167 foreach (Material val
in sharedMaterials)
2169 if ((Object)(object)val != (Object)
null && !((Object)val).name.Contains(
"(Instance)") && !materials.Contains(val))
2175 Terrain[] componentsInChildren2 = current.GetComponentsInChildren<Terrain>();
2176 foreach (Terrain val2
in componentsInChildren2)
2178 if ((Object)(object)val2.materialTemplate != (Object)
null && !((Object)val2.materialTemplate).name.Contains(
"(Instance)") && !materials.Contains(val2.materialTemplate))
2180 materials.Add(val2.materialTemplate);
2182 if (!((Object)(object)val2.terrainData != (Object)
null))
2186 if (val2.terrainData.treePrototypes !=
null)
2188 IEnumerable<GameObject> val3 = Enumerable.Where<GameObject>(Enumerable.Select<TreePrototype, GameObject>((IEnumerable<TreePrototype>)(
object)val2.terrainData.treePrototypes, (Func<TreePrototype, GameObject>)((TreePrototype p) => p.prefab)), (Func<GameObject, bool>)((GameObject o) => (Object)(
object)o != (Object)
null));
2189 prefabs.AddRange(val3);
2191 if (val2.terrainData.detailPrototypes !=
null)
2193 IEnumerable<GameObject> val4 = Enumerable.Where<GameObject>(Enumerable.Select<DetailPrototype, GameObject>((IEnumerable<DetailPrototype>)(
object)val2.terrainData.detailPrototypes, (Func<DetailPrototype, GameObject>)((DetailPrototype p) => p.prototype)), (Func<GameObject, bool>)((GameObject o) => (Object)(
object)o != (Object)
null));
2194 prefabs.AddRange(val4);
2201 if (enumerator !=
null)
2203 ((IDisposable)enumerator).Dispose();
2210 if ((Object)(
object)rootObj != (Object)
null)
2212 for (
int i = 0; i < rootObj.transform.childCount; i++)
2221 if (!Directory.Exists(rootPath))
2225 string[] files = Directory.GetFiles(rootPath);
2226 foreach (
string text
in files)
2228 string text2 = String.Concat(
"Assets", ((Char)(ref Path.DirectorySeparatorChar)).ToString(), text.Substring(String.Concat(Application.dataPath, ((Char)(ref Path.DirectorySeparatorChar)).ToString()).Length));
2229 if (!text2.Contains(
"Assets/Resources") || !text2.Contains(
"Assets/StreamingAssets"))
2233 string text3 = text.ToLower();
2234 if (text3.EndsWith(
".prefab"))
2236 Object obj = AssetDatabase.LoadMainAssetAtPath(text2);
2237 GameObject val = (GameObject)(
object)((obj is GameObject) ? obj :
null);
2238 if ((Object)(object)val != (Object)
null)
2244 Debug.LogError((
object)String.Concat(
"Could not load ", text2));
2247 else if (text3.EndsWith(
".mat"))
2249 Object obj2 = AssetDatabase.LoadMainAssetAtPath(text2);
2250 Material val2 = (Material)(
object)((obj2 is Material) ? obj2 :
null);
2251 if ((Object)(object)val2 != (Object)
null)
2253 materials.Add(val2);
2257 Debug.LogError((
object)String.Concat(
"Could not load ", text2));
2261 files = Directory.GetDirectories(rootPath);
2262 foreach (
string rootPath2
in files)
2270 List<GameObject> val =
new List<GameObject>();
2271 IEnumerator<GameObject> enumerator = Enumerable.Where<GameObject>((IEnumerable<GameObject>)(
object)prefabs, (Func<GameObject, bool>)((GameObject p) => (Object)(
object)p != (Object)
null)).GetEnumerator();
2274 while (((IEnumerator)enumerator).MoveNext())
2276 _ = enumerator.Current;
2281 if (enumerator !=
null)
2283 ((IDisposable)enumerator).Dispose();
2288 prefabs.AddRange((IEnumerable<GameObject>)(object)val);
2317 [Obsolete(
"Uploads from SDK Builder are no longer supported")]
2326 [Obsolete(
"Uploads from SDK Builder are no longer supported")]
2329 [Obsolete(
"Uploads from SDK Builder are no longer supported")]
2340 private static readonly HashSet<Type> _builderTypes;
2342 private static readonly Dictionary<string, ISDKBuilder> _buildersByName;
2352 [field: CompilerGenerated]
2365 return (
BuildType)SessionState.GetInt(
"Session.ActiveBuildType", 0);
2369 SessionState.SetInt(
"Session.ActiveBuildType", (
int)value);
2391 _builderTypes =
new HashSet<Type>();
2392 _buildersByName =
new Dictionary<string, ISDKBuilder>();
2393 LocalLowGUID =
new Guid(
"A520A1A4-1780-4FF6-BD18-167343C5AF16");
2397 while (enumerator.MoveNext())
2404 ((IDisposable)enumerator).Dispose();
2424 if (builderType == (Type)
null)
2426 throw new ArgumentNullException(
"builderType");
2428 if (!_builderTypes.Contains(builderType))
2430 _builderTypes.Add(builderType);
2432 string name = iSDKBuilder.
Name;
2433 if (!_buildersByName.ContainsKey(name))
2435 _buildersByName.Add(name, iSDKBuilder);
2443 _currentBuilder = iSDKBuilder;
2445 else if (((Object)_buildersByName[name]).GetType() != ((Object)iSDKBuilder).GetType())
2447 throw new ArgumentException(String.Concat(
"A different SDK builder type with the same name '", name,
"' has already been Registered."));
2454 if (_currentBuilder !=
null)
2456 _currentBuilder.OnBuildStarted += eventHandler;
2462 if (_currentBuilder !=
null)
2464 _currentBuilder.OnBuildProgress += eventHandler;
2470 if (_currentBuilder !=
null)
2472 _currentBuilder.OnBuildContentProcessed += eventHandler;
2478 if (_currentBuilder !=
null)
2480 _currentBuilder.OnBuildSuccess += eventHandler;
2486 if (_currentBuilder !=
null)
2488 _currentBuilder.OnBuildSuccessWithSignature += eventHandler;
2494 if (_currentBuilder !=
null)
2496 _currentBuilder.OnBuildError += eventHandler;
2508 if (_currentBuilder !=
null)
2510 _currentBuilder.OnContentPreUpload += eventHandler;
2521 return (
ISDKBuilder)Activator.CreateInstance(builderType);
2528 List<Type> val =
new List<Type>();
2529 Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies();
2530 foreach (Assembly val2
in assemblies)
2544 if (vRCSdkBuilderAttribute !=
null && typeFromHandle.IsAssignableFrom(vRCSdkBuilderAttribute.
Type))
2546 val.Add(vRCSdkBuilderAttribute.
Type);
2555 if (!ConfigManager.RemoteConfig.IsInitialized())
2557 API.SetOnlineMode(online:
true);
2558 ConfigManager.RemoteConfig.Init();
2560 if (!APIUser.IsLoggedIn && ApiCredentials.Load())
2562 APIUser.InitialFetchCurrentUser(delegate(ApiModelContainer<APIUser> c)
2564 AnalyticsSDK.LoggedInUserChanged(c.Model as APIUser);
2567 if (!APIUser.IsLoggedIn)
2569 GUILayout.Label(
"Please use the \"VRChat SDK/Settings\" window to log in.", EditorStyles.boldLabel, Array.Empty<GUILayoutOption>());
2583 throw new Exception(
"Can't find Worlds SDK, make sure you have it installed!");
2597 throw new Exception(
"Can't find Worlds SDK, make sure you have it installed!");
2603 [Obsolete(
"Use Upload methods from VRC.SDKBase.Editor.Api.VRCApi class for uploads")]
2606 Debug.LogError((
object)
"Uploads via the SDK Builder are no longer supported");
2609 [Obsolete(
"Use Upload methods from VRC.SDKBase.Editor.Api.VRCApi class for uploads")]
2612 Debug.LogError((
object)
"Uploads via the SDK Builder are no longer supported");
2625 throw new Exception(
"Can't find Avatars SDK, make sure you have it installed!");
2630 [Obsolete(
"Use Upload methods from VRC.SDKBase.Editor.Api.VRCApi class for uploads")]
2633 Debug.LogError((
object)
"Uploads via the SDK Builder are no longer supported");
2647 throw new Exception(
"Can't find Avatars SDK, make sure you have it installed!");
2660 throw new Exception(
"Can't find Worlds SDK, make sure you have it installed!");
2674 throw new Exception(
"Can't find Worlds SDK, make sure you have it installed!");
2688 throw new Exception(
"Can't find Avatars SDK, make sure you have it installed!");
2696 if (String.IsNullOrEmpty(EditorPrefs.GetString(
"lastVRCPath")))
2700 string text = UnityWebRequest.EscapeURL(EditorPrefs.GetString(
"lastVRCPath")).Replace(
"+",
"%20");
2706 return String.Concat(String.Concat(
"vrchat://create?roomId=", randomRoomDigits),
"&url=file:///", text);
2712 EditorSceneManager.SaveOpenScenes();
2717 Object.DestroyImmediate((Object)(
object)gameObject);
2727 if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
2731 if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
2733 return Path.Combine(Environment.GetFolderPath((SpecialFolder)40),
"Library",
"Application Support");
2735 if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
2737 return Environment.GetFolderPath((SpecialFolder)28);
2739 throw new SystemException(
"This platform is not currently supported");
2745 System.IntPtr pszPath = IntPtr.Zero;
2751 return Marshal.PtrToStringAuto(pszPath);
2753 throw Marshal.GetExceptionForHR(num);
2761 if (pszPath != IntPtr.Zero)
2763 Marshal.FreeCoTaskMem(pszPath);
2768 [DllImport(
"shell32.dll")]
2769 private static extern int SHGetKnownFolderPath([MarshalAs(43)] Guid rfid, uint dwFlags, System.IntPtr hToken, out System.IntPtr pszPath);
2863 return EditorPrefs.GetInt(
"activeWindowPanel", 0);
2867 EditorPrefs.SetInt(
"activeWindowPanel", value);
2875 return EditorPrefs.GetBool(
"displayAdvancedSettings",
false);
2879 EditorPrefs.SetBool(
"displayAdvancedSettings", value);
2887 return EditorPrefs.GetBool(
"displayHelpBoxes",
true);
2891 EditorPrefs.SetBool(
"displayHelpBoxes", value);
2899 return EditorPrefs.GetBool(
"forceNoVR",
true);
2903 EditorPrefs.SetBool(
"forceNoVR", value);
2911 return EditorPrefs.GetInt(
"numClients", 1);
2915 EditorPrefs.SetInt(
"numClients", value);
2923 return EditorPrefs.GetBool(
"watchWorlds",
true);
2927 EditorPrefs.SetBool(
"watchWorlds", value);
2935 return EditorPrefs.GetBool(
"vrcConstraintsInEditMode",
true);
2939 EditorPrefs.SetBool(
"vrcConstraintsInEditMode", value);
2947 return EditorPrefs.GetString(
"androidPackageName",
"com.vrchat.mobile.playstore");
2951 EditorPrefs.SetString(
"androidPackageName", value);
2959 return EditorPrefs.GetString(
"questPackageName",
"com.vrchat.oculus.quest");
2963 EditorPrefs.SetString(
"questPackageName", value);
2972 private static ValueTuple<DateTime, int> _lastBuildReportFileSize;
2978 return (
int)EditorUserBuildSettings.selectedBuildTargetGroup != 1;
2990 if (assetBundleSizeLimit < 0)
2994 if (String.IsNullOrEmpty(vrcFilePath) || !File.Exists(vrcFilePath))
2998 FileInfo val =
new FileInfo(vrcFilePath);
2999 fileSize = (int)val.Length;
3000 if (fileSize > assetBundleSizeLimit)
3005 catch (Exception val2)
3007 Debug.LogError((
object)String.Concat(
"Couldn't open file: ", vrcFilePath));
3008 Debug.LogException(val2);
3028 if (assetBundleSizeLimit < 0)
3032 string text =
"Assets/Build AssetBundles.buildreport";
3033 if (File.Exists(
"Library/LastBuild.buildreport"))
3035 DateTime lastWriteTimeUtc = File.GetLastWriteTimeUtc(
"Library/LastBuild.buildreport");
3036 if (lastWriteTimeUtc == _lastBuildReportFileSize.Item1)
3038 fileSize = _lastBuildReportFileSize.Item2;
3042 File.Copy(
"Library/LastBuild.buildreport", text,
true);
3043 AssetDatabase.ImportAsset(text);
3044 BuildReport val = AssetDatabase.LoadAssetAtPath<BuildReport>(text);
3045 fileSize = (int)Enumerable.Sum<PackedAssets>((IEnumerable<PackedAssets>)(object)val.packedAssets, (Func<PackedAssets, Decimal>)((PackedAssets f) => Enumerable.Sum<PackedAssetInfo>((IEnumerable<PackedAssetInfo>)(object)f.contents, (Func<PackedAssetInfo, Decimal>)((PackedAssetInfo a) => Decimal.op_Implicit(((PackedAssetInfo)(ref a)).packedSize))) + Decimal.op_Implicit(f.overhead)));
3046 AssetDatabase.DeleteAsset(text);
3047 _lastBuildReportFileSize =
new ValueTuple<DateTime, int>(lastWriteTimeUtc, fileSize);
3050 if (fileSize > assetBundleSizeLimit)
3055 catch (Exception val2)
3057 Debug.LogError((
object)
"Couldn't get info from last build report");
3058 Debug.LogException(val2);
3074 public static void SetupV3UI(Func<bool> validationFunc, Action onPublishAction, VisualElement _v3Block)
3082 [CustomPropertyDrawer()]
3085 public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
3100 if ((
int)property.propertyType == 14)
3102 Rect val = position;
3103 ((Rect)(ref val)).width = ((Rect)(ref val)).width - 32f;
3104 EditorGUI.CurveField(val, property, Color.cyan,
new Rect(curveAttribute.
PosX, curveAttribute.
PosY, curveAttribute.
RangeX, curveAttribute.
RangeY));
3106 ((Rect)(ref val)).x = ((Rect)(ref val)).x + (((Rect)(ref val)).width - 32f);
3107 ((Rect)(ref val)).width = 32f;
3108 if (GUI.Button(val,
"X"))
3110 AnimationCurve animationCurveValue =
new AnimationCurve();
3111 property.animationCurveValue = animationCurveValue;
3116 [CustomPropertyDrawer()]
3123 if (!(((DecoratorDrawer)
this).attribute is
HelpBoxAttribute helpBoxAttribute))
3125 return ((DecoratorDrawer)
this).GetHeight();
3127 GUIStyle val = (((Object)(
object)GUI.skin != (Object)
null) ? GUI.skin.GetStyle(
"helpbox") :
null);
3130 return ((DecoratorDrawer)
this).
GetHeight();
3132 return Mathf.Max(40f, val.CalcHeight(
new GUIContent(helpBoxAttribute.text), EditorGUIUtility.currentViewWidth) + 4f);
3135 public override void OnGUI(Rect position)
3139 if (((DecoratorDrawer)
this).attribute is
HelpBoxAttribute helpBoxAttribute)
3141 EditorGUI.HelpBox(position, helpBoxAttribute.text,
GetMessageType(helpBoxAttribute.messageType));
3147 return (MessageType)(helpBoxMessageType
switch
3149 HelpBoxAttribute.MessageType.Info => 1,
3150 HelpBoxAttribute.MessageType.Warning => 2,
3151 HelpBoxAttribute.MessageType.Error => 3,
3159 [CustomPropertyDrawer()]
3162 public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
3169 EditorGUI.BeginProperty(position, label, property);
3170 position = EditorGUI.PrefixLabel(position, GUIUtility.GetControlID((FocusType)2), label);
3171 int indentLevel = EditorGUI.indentLevel;
3172 EditorGUI.indentLevel = 0;
3173 EditorGUI.PropertyField(
new Rect(((Rect)(ref position)).x, ((Rect)(ref position)).y, ((Rect)(ref position)).width, ((Rect)(ref position)).height), property.FindPropertyRelative(
"url"), GUIContent.none);
3174 EditorGUI.indentLevel = indentLevel;
3175 EditorGUI.EndProperty();
3189 private static MethodInfo _clearConsoleMethod;
3195 if (_clearConsoleMethod == (MethodInfo)
null)
3197 _clearConsoleMethod = Assembly.GetAssembly(typeof(SceneView)).GetType(
"UnityEditor.LogEntries").GetMethod(
"Clear");
3199 return _clearConsoleMethod;
3203 [MenuItem(
"VRChat SDK/Reload SDK")]
3211 if (Directory.Exists(
"Packages/com.vrchat.worlds/Runtime/VRCSDK/Plugins"))
3213 AssetDatabase.ImportAsset(
"Packages/com.vrchat.worlds/Runtime/VRCSDK/Plugins/VRCSDK3.dll", (ImportAssetOptions)8);
3214 AssetDatabase.ImportAsset(
"Packages/com.vrchat.worlds/Runtime/VRCSDK/Plugins/VRCSDK3-Editor.dll", (ImportAssetOptions)8);
3216 if (Directory.Exists(
"Packages/com.vrchat.avatars/Runtime/VRCSDK/Plugins"))
3218 AssetDatabase.ImportAsset(
"Packages/com.vrchat.avatars/Runtime/VRCSDK/Plugins/VRCSDK3A.dll", (ImportAssetOptions)8);
3219 AssetDatabase.ImportAsset(
"Packages/com.vrchat.avatars/Runtime/VRCSDK/Plugins/VRCSDK3A-Editor.dll", (ImportAssetOptions)8);
3221 if (Directory.Exists(
"Assets/VRCSDK/Plugins/"))
3223 AssetDatabase.ImportAsset(
"Assets/VRCSDK/Plugins//VRCSDK3.dll", (ImportAssetOptions)8);
3224 AssetDatabase.ImportAsset(
"Assets/VRCSDK/Plugins//VRCSDK3-Editor.dll", (ImportAssetOptions)8);
3225 AssetDatabase.ImportAsset(
"Assets/VRCSDK/Plugins//VRCSDK3A.dll", (ImportAssetOptions)8);
3226 AssetDatabase.ImportAsset(
"Assets/VRCSDK/Plugins//VRCSDK3A-Editor.dll", (ImportAssetOptions)8);
3240 if (EditorUtility.DisplayDialog(
"Would you like to reload the current scene?",
"After Reloading the SDK, it can help to reload the open scene to restore missing components",
"Yes, Reload the Scene",
"No, Don't Reload."))
3242 Scene activeScene = SceneManager.GetActiveScene();
3243 string path = ((Scene)(ref activeScene)).path;
3244 if (!String.IsNullOrWhiteSpace(path) && EditorSceneManager.SaveCurrentModifiedScenesIfUserWantsTo())
3246 EditorSceneManager.CloseScene(SceneManager.GetActiveScene(),
true);
3247 EditorSceneManager.OpenScene(path);
3291 private static readonly List<IVRCSDKBuildRequestedCallback> _buildRequestedCallbacks =
new List<IVRCSDKBuildRequestedCallback>();
3295 private static readonly List<IVRCSDKPreprocessAvatarCallback> _preprocessAvatarCallbacks =
new List<IVRCSDKPreprocessAvatarCallback>();
3299 private static readonly List<IVRCSDKPostprocessAvatarCallback> _postprocessAvatarCallbacks =
new List<IVRCSDKPostprocessAvatarCallback>();
3303 private static readonly List<IVRCSDKPreprocessSceneCallback> _preprocessSceneCallbacks =
new List<IVRCSDKPreprocessSceneCallback>();
3307 private static readonly List<IVRCSDKPostprocessSceneCallback> _postprocessSceneCallbacks =
new List<IVRCSDKPostprocessSceneCallback>();
3309 [InitializeOnLoadMethod]
3312 Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies();
3313 foreach (Assembly val
in assemblies)
3317 Type[] types = val.GetTypes();
3318 foreach (Type val2
in types)
3320 if (!val2.IsAbstract && !val2.IsInterface)
3322 if (_buildRequestedCallbackInterfaceType.IsAssignableFrom(val2))
3326 if (_preprocessAvatarCallbackInterfaceType.IsAssignableFrom(val2))
3330 if (_postprocessAvatarCallbackInterfaceType.IsAssignableFrom(val2))
3334 if (_preprocessSceneCallbackInterfaceType.IsAssignableFrom(val2))
3338 if (_postprocessSceneCallbackInterfaceType.IsAssignableFrom(val2))
3345 catch (ReflectionTypeLoadException)
3347 Debug.LogWarning((
object)String.Concat(
"VRCBuildPipelineCallbacks failed to load a type in assembly '", val.FullName,
"'. If this is Assembly-CSharp it's just Unity being in the middle of loading."));
3348 SessionState.SetInt(
"ReloadPlugins", 3);
3357 IEnumerator<IVRCSDKBuildRequestedCallback> enumerator = ((IEnumerable<IVRCSDKBuildRequestedCallback>)(
object)Enumerable.OrderBy<
IVRCSDKBuildRequestedCallback,
int>((IEnumerable<IVRCSDKBuildRequestedCallback>)(
object)_buildRequestedCallbacks, (Func<IVRCSDKBuildRequestedCallback, int>)((
IVRCSDKBuildRequestedCallback callback) => ((IOrderedCallback)callback).callbackOrder))).GetEnumerator();
3360 while (((IEnumerator)enumerator).MoveNext())
3369 string text = String.Concat(
"The the VRCSDK build was aborted at the request of the '", ((MemberInfo)((Object)current).GetType()).Name,
"' VRCSDKBuildRequestedCallback");
3370 Debug.LogError((
object)text);
3371 EditorUtility.DisplayDialog(
"Build Aborted", text,
"Ok");
3374 catch (Exception val)
3376 string text2 = String.Concat(
"The VRCSDK build was aborted due to an exception in the '", ((MemberInfo)((Object)current).GetType()).Name,
"' VRCSDKBuildRequestedCallback.\nCheck the log for details.");
3377 Debug.LogError((
object)text2);
3378 Debug.LogException(val);
3379 EditorUtility.DisplayDialog(
"Exception in OnBuildRequested Callback", text2,
"Ok");
3385 if (enumerator !=
null)
3387 ((IDisposable)enumerator).Dispose();
3397 IEnumerator<IVRCSDKPreprocessAvatarCallback> enumerator = ((IEnumerable<IVRCSDKPreprocessAvatarCallback>)(
object)Enumerable.OrderBy<
IVRCSDKPreprocessAvatarCallback,
int>((IEnumerable<IVRCSDKPreprocessAvatarCallback>)(
object)_preprocessAvatarCallbacks, (Func<IVRCSDKPreprocessAvatarCallback, int>)((
IVRCSDKPreprocessAvatarCallback callback) => ((IOrderedCallback)callback).callbackOrder))).GetEnumerator();
3400 while (((IEnumerator)enumerator).MoveNext())
3409 string text = String.Concat(
"The VRCSDK build was aborted because the VRCSDKPreprocessAvatarCallback '", ((MemberInfo)((Object)current).GetType()).Name,
"' reported a failure.");
3410 Debug.LogError((
object)text);
3411 EditorUtility.DisplayDialog(
"Preprocess Callback Failed", text,
"Ok");
3414 catch (Exception val)
3416 string text2 = String.Concat(
"The VRCSDK build was aborted because the VRCSDKPreprocessAvatarCallback '", ((MemberInfo)((Object)current).GetType()).Name,
"' threw an exception.\nCheck the log for details.");
3417 Debug.LogError((
object)text2);
3418 Debug.LogException(val);
3419 EditorUtility.DisplayDialog(
"Exception in VRCSDKPreprocessAvatarCallback Callback", text2,
"Ok");
3426 if (enumerator !=
null)
3428 ((IDisposable)enumerator).Dispose();
3438 IEnumerator<IVRCSDKPostprocessAvatarCallback> enumerator = ((IEnumerable<IVRCSDKPostprocessAvatarCallback>)(
object)Enumerable.OrderBy<
IVRCSDKPostprocessAvatarCallback,
int>((IEnumerable<IVRCSDKPostprocessAvatarCallback>)(
object)_postprocessAvatarCallbacks, (Func<IVRCSDKPostprocessAvatarCallback, int>)((
IVRCSDKPostprocessAvatarCallback callback) => ((IOrderedCallback)callback).callbackOrder))).GetEnumerator();
3441 while (((IEnumerator)enumerator).MoveNext())
3448 catch (Exception val)
3450 string text = String.Concat(
"VRCSDKPostprocessAvatarCallback Callback '", ((MemberInfo)((Object)current).GetType()).Name,
"' threw an exception.\nCheck the log for details.");
3451 Debug.LogError((
object)text);
3452 Debug.LogException(val);
3453 EditorUtility.DisplayDialog(
"Exception in VRCSDKPostprocessAvatarCallback Callback", text,
"Ok");
3459 if (enumerator !=
null)
3461 ((IDisposable)enumerator).Dispose();
3471 IEnumerator<IVRCSDKPreprocessSceneCallback> enumerator = ((IEnumerable<IVRCSDKPreprocessSceneCallback>)(
object)Enumerable.OrderBy<
IVRCSDKPreprocessSceneCallback,
int>((IEnumerable<IVRCSDKPreprocessSceneCallback>)(
object)_preprocessSceneCallbacks, (Func<IVRCSDKPreprocessSceneCallback, int>)((
IVRCSDKPreprocessSceneCallback callback) => ((IOrderedCallback)callback).callbackOrder))).GetEnumerator();
3474 while (((IEnumerator)enumerator).MoveNext())
3483 string text = String.Concat(
"The VRCSDK build was aborted because the IVRCSDKPreprocessSceneCallback '", ((MemberInfo)((Object)current).GetType()).Name,
"' reported a failure.");
3484 Debug.LogError((
object)text);
3485 EditorUtility.DisplayDialog(
"Preprocess Callback Failed", text,
"Ok");
3488 catch (Exception val)
3490 string text2 = String.Concat(
"The VRCSDK build was aborted because the IVRCSDKPreprocessSceneCallback '", ((MemberInfo)((Object)current).GetType()).Name,
"' threw an exception.\nCheck the log for details.");
3491 Debug.LogError((
object)text2);
3492 Debug.LogException(val);
3493 EditorUtility.DisplayDialog(
"Exception in IVRCSDKPreprocessSceneCallback Callback", text2,
"Ok");
3499 if (enumerator !=
null)
3501 ((IDisposable)enumerator).Dispose();
3512 IEnumerator<IVRCSDKPostprocessSceneCallback> enumerator = ((IEnumerable<IVRCSDKPostprocessSceneCallback>)(
object)Enumerable.OrderBy<
IVRCSDKPostprocessSceneCallback,
int>((IEnumerable<IVRCSDKPostprocessSceneCallback>)(
object)_postprocessSceneCallbacks, (Func<IVRCSDKPostprocessSceneCallback, int>)((
IVRCSDKPostprocessSceneCallback callback) => ((IOrderedCallback)callback).callbackOrder))).GetEnumerator();
3515 while (((IEnumerator)enumerator).MoveNext())
3522 catch (Exception val)
3524 string text = String.Concat(
"IVRCSDKPostprocessSceneCallback Callback '", ((MemberInfo)((Object)current).GetType()).Name,
"' threw an exception.\nCheck the log for details.");
3525 Debug.LogError((
object)text);
3526 Debug.LogException(val);
3527 EditorUtility.DisplayDialog(
"Exception in IVRCSDKPostprocessSceneCallback Callback", text,
"Ok");
3533 if (enumerator !=
null)
3535 ((IDisposable)enumerator).Dispose();
3547 [field: CompilerGenerated]
3563 [field: CompilerGenerated]
bool OnPreprocessAvatar(GameObject avatarGameObject)
bool OnPreprocessScene(Scene scene)
static void DrawWirePlane(Vector3 center, Quaternion rotation, float size)
static void DrawWireCylinder(Vector3 center, float radius, float height, Quaternion rotation=default(Quaternion))
static void DrawWireCube(Vector3 center, Vector3 size, Quaternion rotation=default(Quaternion))
static void DrawWireAngleCone(Vector3 tip, Quaternion rotation, float radius, float angle, int segments=12)
static void DrawWireCylinder(Vector3 center, float height, float radius1, float radius2, Quaternion rotation=default(Quaternion))
static void DrawWireCone(Vector3 tip, Quaternion rotation, float height, float radius)
static void SetColor(Color color, float alpha)
static void DrawWireSquare(Vector3 center, Quaternion rotation, Vector2 size)
static void DrawWireCapsule(Vector3 center, float radius, float height, Quaternion rotation=default(Quaternion))
static void DrawWireSphere(Vector3 center, float radius, Quaternion rotation=default(Quaternion))
static void DrawWireArc(Vector3 center, float radius, float angle, int segments, Quaternion rotation, Vector3 centerOfRotation)
static void DrawWireArc(Matrix4x4 matrix, float radius, float angle, int segments)
static void DrawWireCapsule(Vector3 point1, Vector3 point2, float radius1, float radius2)
static void DrawWireCircle(Vector3 center, float radius, int segments=20, Quaternion rotation=default(Quaternion))
static void DrawWireCapsule(Vector3 center, Quaternion rotation, float height, float radius1, float radius2)
static void DrawArrow(Vector3 from, Vector3 to, float arrowHeadLength=0.25f, float arrowHeadAngle=20f)
static void DrawWireArc(Vector3 center, float radius, float angle, int segments=20, Quaternion rotation=default(Quaternion))
static void DrawWireCapsuleEndcap(Vector3 center, Quaternion rotation, float half, float radius, bool isUp)
static int AddCylinderSidePoints(ref List< Vector3 > buffer, float beginRadius, float endRadius, float half)
static void DrawWireCapsule(Vector3 center, Quaternion rotation, float height, float radius1, float radius2)
static int AddCylinderCapPoints(ref List< Vector3 > buffer, float beginRadius, float endRadius, float half)
static void DrawWireCylinder(Vector3 center, float height, float radius1, float radius2, Quaternion rotation=default(Quaternion), int segments=8)
static List< Quaternion > SphereGizmoRotations
const int RADIUS_GIZMO_SIDES_OFFSET
const int RADIUS_GIZMO_CAP_OFFSET
static void DrawWireCapsule(Vector3 center, Quaternion rotation, float height, float radius)
static int DrawCapsuleBatched(ref List< Vector3 > buffer, int offset, Color color, Matrix4x4 matrix)
static int AddLineToBatch(ref List< Vector3 > buffer, Vector3 start, Vector3 end)
static void DrawWireSphere(Vector3 center, Quaternion rotation, float radius)
static void DrawWireSphere(Vector3 center, float radius)
static int AddCapsuleCapPoints(ref List< Vector3 > buffer, float beginRadius, float endRadius, float half)
const int RADIUS_GIZMO_CAPS_SIZE
static void DrawWirePlane(Vector3 center, Vector3 normal, float size)
static void DrawWireSquare(Vector3 center, Quaternion rotation, float size)
static void DrawWireSquare(Vector3 center, Vector3 normal, float size)
const int RADIUS_GIZMO_SPHERE_SIZE
static void DrawSolidAngleCone(Vector3 tip, Quaternion rotation, float radius, float angle)
static void ApplyWireMaterial()
const int RADIUS_GIZMO_CAPSULE_CAPS_SIZE
static void DrawWireAngleCone(Vector3 tip, Quaternion rotation, float radius, float angle, int segments=12)
static void DrawWireCapsuleEndcap(Vector3 center, Quaternion rotation, float half, float radius, bool isUp)
static int DrawSphereBatched(ref List< Vector3 > buffer, int offset, Color color, Matrix4x4 matrix)
static int AddCapsuleToBatch(ref List< Vector3 > buffer, float beginRadius, float endRadius, float half)
static List< Quaternion > CapsuleGizmoRotations
static int AddSphereToBatch(ref List< Vector3 > buffer, float radius)
static int DrawLineBatched(ref List< Vector3 > buffer, int offset, Color color)
const int RADIUS_GIZMO_SPHERE_OFFSET
const int LINE_GIZMOS_SIZE
static void SetColor(Color color, float alpha)
static void DrawEditableArray(Editor editor, EditableArray data, ref int selected)
static void QuaternionAsEulerField(SerializedProperty property)
static GUIStyle Style_BoxNormal
static GUIStyle Style_BoxSelected
static Texture2D MakeStyleBackground(Color color)
bool OnPreprocessAvatar(GameObject avatarGameObject)
bool OnPreprocessAvatar(GameObject avatarGameObject)
string staticFunctionName
bool< AddOnAssemblyReloadCallback > b__0(SerializableFunction sf)
static List< string > GetLoadedAssemblies()
static string SERIALIZATION_PATH
static string TMP_FILE_PATH
static List< SerializableFunction > OnAssemblyReloadCallbacks
static void OnCompileScripts()
delegate void OnDeserialized()
static void ClearAssemblyReloadCallbacks()
static void AddOnAssemblyReloadCallback(string className, string staticFunctionName, bool autoSerialize=true)
static void ExecuteAssemblyReloadCallbacks()
static void ReloadAssemblies()
static List< string > GetCustomLoadedAssembles()
OnDeserialized onDeserialized
static void SerializeCallbacks()
static void DeserializeCallbacks()
SerializableFunction(string _className, string _methodName)
static void FindPrefabsThatCanBeToggledActiveInScene(ref List< GameObject > prefabs, GameObject rootObj=null)
static void FindDynamicContent(ref List< GameObject > prefabs, ref List< Material > materials)
static void DoPreExportShaderReplacement()
static string GetActiveSceneUnityPackageExportPath()
static void FindMaterialsOnObjects(IEnumerable< GameObject > objs, ref List< GameObject > prefabs, ref List< Material > materials)
static void CleanupUnityPackageExport()
static void FindDynamicContentInProject(ref List< GameObject > prefabs, ref List< Material > materials, string rootPath)
static void ExportCurrentAssetAsUnityPackage(List< string > assetPaths, string dstPath)
static void ExportCurrentSceneAsUnityPackageIfNotExist()
static void AddAlwaysIncludedShaders(IEnumerable< Shader > shaders)
static void FindMaterialsAndPrefabsInScene(ref List< GameObject > prefabs, ref List< Material > materials)
static bool FindPrefabReferencesOnPrefabs(ref List< GameObject > prefabs)
static void ExportCurrentSceneAsUnityPackage()
static void CleanupTmpFiles()
VRCAssetExporterAttribute(Type type)
VRCSdkBuilderAttribute(Type type)
static void OnPostprocessAvatar()
static bool OnVRCSDKBuildRequested(VRCSDKRequestedBuildType requestedBuildType)
static bool OnPreprocessScene(Scene scene)
static void OnPostprocessScene(Scene scene)
static bool OnPreprocessAvatar(GameObject avatarGameObject)
override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
override void OnGUI(Rect position)
override float GetHeight()
MessageType GetMessageType(HelpBoxAttribute.MessageType helpBoxMessageType)
static MethodInfo clearConsoleMethod
const string worldsPackageRuntimePluginsFolder
static void ClearLogConsole()
const string legacyRuntimePluginsFolder
static void ReloadCurrentScene()
static void ReloadSDK(bool clearConsole)
const string avatarsPackageRuntimePluginsFolder
override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
static void SetupV3UI(Func< bool > validationFunc, Action onPublishAction, VisualElement _v3Block)
static string QuestPackageName
const string editorPrefDisplayAdvancedSettings
const string editorPrefVrcConstraintsInEditMode
const string editorPrefAndroidPackageName
const string editorPrefDisplayHelpBoxes
const string editorPrefWatchWorlds
static bool DisplayAdvancedSettings
const string editorPrefQuestPackageName
static bool VrcConstraintsInEditMode
static int ActiveWindowPanel
static string AndroidPackageName
const string editorPrefForceNoVR
const string editorPrefNumClients
const string editorPrefActiveWindowPanel
static bool DisplayHelpBoxes
static void DoDestroyImmediate(GameObject gameObject)
static Action RunLastExportedSceneResourceAction
const string SESSION_BUILD_TYPE_KEY
static Func< GameObject, bool > RunExportAvatarBlueprint
static string GetLastUrl()
static Action RunExportSceneToV3
static bool ExportAndTestAvatarBlueprint(GameObject externalReference=null)
static string GetKnownFolderPath(Guid knownFolderId)
static bool ExportAvatarBlueprint(GameObject externalReference=null)
static void RegisterBuildProgressCallback(EventHandler< string > eventHandler)
static void RegisterBuildSuccessCallback(EventHandler< string > eventHandler)
static List< Type > GetBuilderTypesFromAttribute()
static void ClearUploadEventHandlers()
static bool VerifyCredentials()
static void RegisterBuildStartedCallback(EventHandler eventHandler)
static bool ExportAndUploadAvatarBlueprint(GameObject externalReference=null)
static void PreBuildBehaviourPackaging()
static ISDKBuilder CreateBuilder(Type builderType)
static void RegisterBuilder([NotNull] Type builderType)
static void RegisterContentPreUploadCallback(EventHandler< object > eventHandler)
static void ExportAvatarToV3(GameObject externalReference=null)
static int SHGetKnownFolderPath([MarshalAs(43)] Guid rfid, uint dwFlags, System.IntPtr hToken, out System.IntPtr pszPath)
static string RandomRoomDigits
static Action RunUploadLastExportedSceneBlueprint
static bool shouldBuildUnityPackage
static Action< GameObject > RunExportAvatarToV3
static string GetLocalLowPath()
static void ExportSceneResourceAndRun()
static Func< bool > RunExportSceneResource
static BuildType ActiveBuildType
static void RegisterBuildSuccessCallback(EventHandler< ValueTuple< string, string > > eventHandler)
static void ExportAndUploadSceneBlueprint()
static void UploadLastExportedSceneBlueprint()
static void ExportSceneResource()
static void RegisterBuildErrorCallback(EventHandler< string > eventHandler)
static void RunLastExportedSceneResource()
static Action RunExportAndUploadSceneBlueprint
static void ExportSceneToV3()
static Func< GameObject, bool > RunExportAndUploadAvatarBlueprint
static Action RunExportSceneResourceAndRun
static Func< GameObject, bool > RunExportAndTestAvatarBlueprint
static void ClearCallbacks()
static void RegisterBuildContentProcessedCallback(EventHandler< object > eventHandler)
static readonly Guid LocalLowGUID
static bool IsMobilePlatform()
static bool CheckIfUncompressedAssetBundleFileTooLarge(ContentType contentType, out int fileSize, bool mobilePlatform)
static bool CheckIfAssetBundleFileTooLarge(ContentType contentType, string vrcFilePath, out int fileSize, bool mobilePlatform)
static ValueTuple< IEnumerable< NetworkIDPair >, IEnumerable< NetworkIDPair > > ConfigureNetworkIDs(INetworkIDContainer container, out List< SetErrorLocation > errors, params SetError[] errorsToIgnore)
static int GetAssetBundleSizeLimit(ContentType contentType, bool mobilePlatform, bool compressed=true)
bool OnBuildRequested(VRCSDKRequestedBuildType requestedBuildType)
void OnPostprocessAvatar()
void OnPostprocessScene(Scene scene)
bool OnPreprocessAvatar(GameObject avatarGameObject)
bool OnPreprocessScene(Scene scene)
void ExportCurrentSceneResource()
void UploadLastExportedSceneBlueprint()
EventHandler< ValueTuple< string, string > > OnBuildSuccessWithSignature
EventHandler< object > OnContentPreUpload
bool ExportAndUploadAvatarBlueprint(GameObject externalReference=null)
EventHandler< string > OnBuildProgress
void RunLastExportedSceneResource()
EventHandler< string > OnBuildError
EventHandler< object > OnBuildContentProcessed
EventHandler OnBuildStarted
void ExportAndUploadSceneBlueprint()
void ExportAvatarToV3(GameObject externalReference=null)
bool ExportAvatarBlueprint(GameObject externalReference=null)
void ClearEventHandlers()
void ExportSceneResourceAndRun()
bool ExportSceneResource()
EventHandler< string > OnBuildSuccess
void ClearUploadEventHandlers()
bool ExportAndTestAvatarBlueprint(GameObject externalReference=null)
Action< SerializedProperty, int > onNewElement
Action< SerializedProperty, int > onDrawElement
Action< SerializedProperty, int > onSelect