コード例 #1
0
        public void ShowBuilder()
        {
            if (_postProcessVolumeType != null)
            {
                if (Camera.main != null && Camera.main.GetComponentInChildren(_postProcessVolumeType))
                {
                    _builder.OnGUIWarning(null,
                                          "Scene has a PostProcessVolume on the Reference Camera (Main Camera). This Camera is disabled at runtime. Please move the PostProcessVolume to another GameObject.",
                                          () => { Selection.activeGameObject = Camera.main.gameObject; },
                                          TryMovePostProcessVolumeAwayFromMainCamera
                                          );
                }
            }

#if UDON
            {
                List <UdonBehaviour> failedBehaviours = ShouldShowPrimitivesWarning();
                if (failedBehaviours.Count > 0)
                {
                    _builder.OnGUIWarning(null,
                                          "Udon Objects reference builtin Unity mesh assets, this won't work. Consider making a copy of the mesh to use instead.",
                                          () =>
                    {
                        Selection.objects = failedBehaviours.Select(s => s.gameObject).Cast <Object>().ToArray();
                    }, FixPrimitivesWarning);
                }
            }
#endif


            if (_scenes.Length > 1)
            {
                Object[] gos = new Object[_scenes.Length];
                for (int i = 0; i < _scenes.Length; ++i)
                {
                    gos[i] = _scenes[i].gameObject;
                }
                _builder.OnGUIError(null,
                                    "A Unity scene containing a VRChat Scene Descriptor should only contain one Scene Descriptor.",
                                    delegate { Selection.objects = gos; }, null);

                EditorGUILayout.Separator();
                GUILayout.BeginVertical(GUILayout.Width(VRCSdkControlPanel.SdkWindowWidth));
                _builder.OnGUIShowIssues();
                GUILayout.EndVertical();
            }
            else if (_scenes.Length == 1)
            {
                bool inScrollView = true;

                _scrollPos = GUILayout.BeginScrollView(_scrollPos, false, false, GUIStyle.none,
                                                       GUI.skin.verticalScrollbar, GUILayout.Width(VRCSdkControlPanel.SdkWindowWidth));

                try
                {
                    bool setupRequired = OnGUISceneSetup();

                    if (!setupRequired)
                    {
                        if (!_builder.CheckedForIssues)
                        {
                            _builder.ResetIssues();
                            OnGUISceneCheck(_scenes[0]);
                            _builder.CheckedForIssues = true;
                        }

                        OnGUISceneSettings(_scenes[0]);

                        _builder.OnGUIShowIssues();
                        _builder.OnGUIShowIssues(_scenes[0]);

                        GUILayout.FlexibleSpace();

                        GUILayout.EndScrollView();
                        inScrollView = false;

                        OnGUIScene();
                    }
                    else
                    {
                        _builder.OnGuiFixIssuesToBuildOrTest();
                        GUILayout.EndScrollView();
                    }
                }
                catch (Exception)
                {
                    if (inScrollView)
                    {
                        GUILayout.EndScrollView();
                    }
                }
            }
            else
            {
                EditorGUILayout.Space();
                if (UnityEditor.BuildPipeline.isBuildingPlayer)
                {
                    GUILayout.Space(20);
                    EditorGUILayout.LabelField("Building – Please Wait ...", VRCSdkControlPanel.titleGuiStyle,
                                               GUILayout.Width(VRCSdkControlPanel.SdkWindowWidth));
                }
            }
        }