public static void SetActiveSDKDefines() { bool definesChanged = false; BuildTargetGroup buildTargetGroup = BuildPipeline.GetBuildTargetGroup(EditorUserBuildSettings.activeBuildTarget); List <string> defines = PlayerSettings.GetScriptingDefineSymbolsForGroup(buildTargetGroup).Split(';').ToList(); Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies(); if (assemblies.Any(assembly => assembly.GetType("VRC.Udon.UdonBehaviour") != null)) { if (!defines.Contains("UDON", StringComparer.OrdinalIgnoreCase)) { defines.Add("UDON"); definesChanged = true; } } else if (defines.Contains("UDON")) { defines.Remove("UDON"); } if (VRCSdk3Analysis.IsSdkDllActive(VRCSdk3Analysis.SdkVersion.VRCSDK2)) { if (!defines.Contains("VRC_SDK_VRCSDK2", StringComparer.OrdinalIgnoreCase)) { defines.Add("VRC_SDK_VRCSDK2"); definesChanged = true; } } else if (defines.Contains("VRC_SDK_VRCSDK2")) { defines.Remove("VRC_SDK_VRCSDK2"); } if (VRCSdk3Analysis.IsSdkDllActive(VRCSdk3Analysis.SdkVersion.VRCSDK3)) { if (!defines.Contains("VRC_SDK_VRCSDK3", StringComparer.OrdinalIgnoreCase)) { defines.Add("VRC_SDK_VRCSDK3"); definesChanged = true; } } else if (defines.Contains("VRC_SDK_VRCSDK3")) { defines.Remove("VRC_SDK_VRCSDK3"); } if (definesChanged) { PlayerSettings.SetScriptingDefineSymbolsForGroup(buildTargetGroup, string.Join(";", defines.ToArray())); } }
void ShowBuilders() { GUILayout.BeginHorizontal(); GUILayout.FlexibleSpace(); GUILayout.BeginVertical(); if (VRC.Core.ConfigManager.RemoteConfig.IsInitialized()) { string sdkUnityVersion = VRC.Core.ConfigManager.RemoteConfig.GetString("sdkUnityVersion"); if (Application.unityVersion != sdkUnityVersion) { OnGUIWarning(null, "You are not using the recommended Unity version for the VRChat SDK. Content built with this version may not work correctly. Please use Unity " + sdkUnityVersion, null, () => { Application.OpenURL("https://unity3d.com/get-unity/download/archive"); } ); } } if (VRCSdk3Analysis.IsSdkDllActive(VRCSdk3Analysis.SdkVersion.VRCSDK2) && VRCSdk3Analysis.IsSdkDllActive(VRCSdk3Analysis.SdkVersion.VRCSDK3)) { List <Component> sdk2Components = VRCSdk3Analysis.GetSDKInScene(VRCSdk3Analysis.SdkVersion.VRCSDK2); List <Component> sdk3Components = VRCSdk3Analysis.GetSDKInScene(VRCSdk3Analysis.SdkVersion.VRCSDK3); if (sdk2Components.Count > 0 && sdk3Components.Count > 0) { OnGUIError(null, "This scene contains components from the VRChat SDK version 2 and version 3. Version two elements will have to be replaced with their version 3 counterparts to build with SDK3 and UDON.", () => { Selection.objects = sdk2Components.ToArray(); }, null ); } } if (Lightmapping.giWorkflowMode == Lightmapping.GIWorkflowMode.Iterative) { OnGUIWarning(null, "Automatic lightmap generation is enabled, which may stall the Unity build process. Before building and uploading, consider turning off 'Auto Generate' at the bottom of the Lighting Window.", () => { EditorWindow lightingWindow = GetLightingWindow(); if (lightingWindow) { lightingWindow.Show(); lightingWindow.Focus(); } }, () => { Lightmapping.giWorkflowMode = Lightmapping.GIWorkflowMode.OnDemand; EditorWindow lightingWindow = GetLightingWindow(); if (!lightingWindow) { return; } lightingWindow.Repaint(); Focus(); } ); } PopulateSdkBuilders(); IVRCSdkControlPanelBuilder selectedBuilder = null; string errorMessage = null; foreach (IVRCSdkControlPanelBuilder sdkBuilder in _sdkBuilders) { if (!sdkBuilder.IsValidBuilder(out string message)) { if (selectedBuilder == null) { errorMessage = message; } } else { if (selectedBuilder == null) { selectedBuilder = sdkBuilder; errorMessage = null; } else { errorMessage = "A Unity scene cannot contain a VRChat Scene Descriptor and also contain VRChat Avatar Descriptors"; } } } if (selectedBuilder == null) { #if VRC_SDK_VRCSDK2 EditorGUILayout.LabelField("A VRC_SceneDescriptor or VRC_AvatarDescriptor\nis required to build VRChat SDK Content", titleGuiStyle, GUILayout.Width(SdkWindowWidth)); #elif VRC_SDK_VRCSDK3 EditorGUILayout.LabelField("A VRCSceneDescriptor or VRCAvatarDescriptor\nis required to build VRChat SDK Content", titleGuiStyle, GUILayout.Width(SdkWindowWidth)); #endif } else if (errorMessage != null) { OnGUIError(null, errorMessage, () => { foreach (IVRCSdkControlPanelBuilder builder in _sdkBuilders) { builder.SelectAllComponents(); } }, null ); OnGUIShowIssues(); } else { selectedBuilder.ShowBuilder(); } if (Event.current.type == EventType.Used) { return; } GUILayout.EndVertical(); GUILayout.FlexibleSpace(); GUILayout.EndHorizontal(); }