Beispiel #1
0
        private static bool SetupLayersCollisionMatrixValidate()
        {
            if (UpdateLayers.AreLayersSetup() && UpdateLayers.IsCollisionLayerMatrixSetup())
            {
                return(false);
            }

            return(true);
        }
Beispiel #2
0
        public static void SetupLayersCollisionMatrix()
        {
            if (!UpdateLayers.AreLayersSetup())
            {
                UpdateLayers.SetupEditorLayers();
            }

            if (!UpdateLayers.IsCollisionLayerMatrixSetup())
            {
                UpdateLayers.SetupCollisionLayerMatrix();
            }
        }
Beispiel #3
0
    void OnGUISceneCheck(VRCSDK2.VRC_SceneDescriptor scene)
    {
        CheckUploadChanges(scene);

        EditorGUILayout.InspectorTitlebar(true, scene.gameObject);

        if (VRC.Core.APIUser.CurrentUser != null && VRC.Core.APIUser.CurrentUser.hasScriptingAccess && !CustomDLLMaker.DoesScriptDirExist())
        {
            CustomDLLMaker.CreateDirectories();
        }

        Vector3 g = Physics.gravity;

        if (g.x != 0.0f || g.z != 0.0f)
        {
            OnGUIWarning(scene, "Gravity vector is not straight down. Though we support different gravity, player orientation is always 'upwards' so things don't always behave as you intend.");
        }
        if (g.y > 0)
        {
            OnGUIWarning(scene, "Gravity vector is not straight down, inverted or zero gravity will make walking extremely difficult.");
        }
        if (g.y == 0)
        {
            OnGUIWarning(scene, "Zero gravity will make walking extremely difficult, though we support different gravity, player orientation is always 'upwards' so this may not have the effect you're looking for.");
        }

        scene.useAssignedLayers = true;
        if (scene.useAssignedLayers)
        {
            if (!UpdateLayers.AreLayersSetup())
            {
                OnGUIWarning(scene, "Layers are not setup properly. Please press the button above.");
            }

            if (UpdateLayers.AreLayersSetup() && !UpdateLayers.IsCollisionLayerMatrixSetup())
            {
                OnGUIWarning(scene, "Physics Collision Layer Matrix is not setup correctly. Please press the button above.");
            }
        }

        // warn those without scripting access if they choose to script locally
        if (VRC.Core.APIUser.CurrentUser != null && !VRC.Core.APIUser.CurrentUser.hasScriptingAccess && CustomDLLMaker.DoesScriptDirExist())
        {
            OnGUIWarning(scene, "Your account does not have permissions to upload custom scripts. You can test locally but need to contact VRChat to publish your world with scripts.");
        }

        // auto create VRCScript dir for those with access
        if (VRC.Core.APIUser.CurrentUser != null && VRC.Core.APIUser.CurrentUser.hasScriptingAccess && !CustomDLLMaker.DoesScriptDirExist())
        {
            CustomDLLMaker.CreateDirectories();
        }
    }
Beispiel #4
0
    private void OnGUI()
    {
        //Editor Window
        using (new GUILayout.VerticalScope())
        {
            EditorGUILayout.LabelField(version);
            if (GUILayout.Button(linktext))
            {
                OpenLink(link);
            }

            EditorGUILayout.Space();
            EditorGUILayout.LabelField("Layer 設定", EditorStyles.boldLabel);
            if (UpdateLayers.AreLayersSetup())
            {
                EditorGUILayout.LabelField("レイヤーは VRChat 向けに設定されています。");
            }
            else
            {
                if (GUILayout.Button("Setup Layers"))
                {
                    if (EditorUtility.DisplayDialog("Setup Layers for VRChat", "プロジェクトのレイヤー設定を VRChat 用に設定します。よろしいですか?", "OK", "Cancel"))
                    {
                        UpdateLayers.SetupEditorLayers();
                    }
                }
            }

            EditorGUILayout.Space();
            EditorGUILayout.LabelField("Collision 設定", EditorStyles.boldLabel);
            if (UpdateLayers.IsCollisionLayerMatrixSetup())
            {
                EditorGUILayout.LabelField("レイヤー毎衝突判定は VRChat 向けに設定されています。");
            }
            else
            {
                if (GUILayout.Button("Setup Collision Matrix"))
                {
                    if (EditorUtility.DisplayDialog("Setup Collision Matrix for VRChat", "プロジェクトのレイヤー毎衝突判定を VRChat 用に設定します。よろしいですか?", "OK", "Cancel"))
                    {
                        UpdateLayers.SetupCollisionLayerMatrix();
                    }
                }
            }
        }
    }
        private static bool OnGUISceneSetup()
        {
            bool mandatoryExpand = !UpdateLayers.AreLayersSetup() || !UpdateLayers.IsCollisionLayerMatrixSetup();

            if (mandatoryExpand)
            {
                EditorGUILayout.LabelField("VRChat Scene Setup", VRCSdkControlPanel.titleGuiStyle,
                                           GUILayout.Height(50));
            }

            if (!UpdateLayers.AreLayersSetup())
            {
                GUILayout.BeginVertical(VRCSdkControlPanel.boxGuiStyle, GUILayout.Height(100),
                                        GUILayout.Width(VRCSdkControlPanel.SdkWindowWidth));
                GUILayout.BeginHorizontal();
                GUILayout.BeginVertical(GUILayout.Width(300));
                EditorGUILayout.Space();
                GUILayout.Label("Layers", VRCSdkControlPanel.infoGuiStyle);
                GUILayout.Label(
                    "VRChat scenes must have the same Unity layer configuration as VRChat so we can all predict things like physics and collisions. Pressing this button will configure your project's layers to match VRChat.",
                    VRCSdkControlPanel.infoGuiStyle, GUILayout.Width(300));
                GUILayout.EndVertical();
                GUILayout.BeginVertical(GUILayout.Width(150));
                GUILayout.Label("", GUILayout.Height(15));
                if (UpdateLayers.AreLayersSetup())
                {
                    GUILayout.Label("Step Complete!", VRCSdkControlPanel.infoGuiStyle);
                }
                else if (GUILayout.Button("Setup Layers for VRChat", GUILayout.Width(172)))
                {
                    bool doIt = EditorUtility.DisplayDialog("Setup Layers for VRChat",
                                                            "This adds all VRChat layers to your project and pushes any custom layers down the layer list. If you have custom layers assigned to gameObjects, you'll need to reassign them. Are you sure you want to continue?",
                                                            "Do it!", "Don't do it");
                    if (doIt)
                    {
                        UpdateLayers.SetupEditorLayers();
                    }
                }

                GUILayout.EndVertical();
                GUILayout.EndHorizontal();
                GUILayout.EndVertical();
                GUILayout.Space(10);
            }

            if (!UpdateLayers.IsCollisionLayerMatrixSetup())
            {
                GUILayout.BeginVertical(VRCSdkControlPanel.boxGuiStyle, GUILayout.Height(100),
                                        GUILayout.Width(VRCSdkControlPanel.SdkWindowWidth));
                GUILayout.BeginHorizontal();
                GUILayout.BeginVertical(GUILayout.Width(300));
                EditorGUILayout.Space();
                GUILayout.Label("Collision Matrix", VRCSdkControlPanel.infoGuiStyle);
                GUILayout.Label(
                    "VRChat uses specific layers for collision. In order for testing and development to run smoothly it is necessary to configure your project's collision matrix to match that of VRChat.",
                    VRCSdkControlPanel.infoGuiStyle, GUILayout.Width(300));
                GUILayout.EndVertical();
                GUILayout.BeginVertical(GUILayout.Width(150));
                GUILayout.Label("", GUILayout.Height(15));
                if (UpdateLayers.AreLayersSetup() == false)
                {
                    GUILayout.Label("You must first configure your layers for VRChat to proceed. Please see above.",
                                    VRCSdkControlPanel.infoGuiStyle);
                }
                else if (UpdateLayers.IsCollisionLayerMatrixSetup())
                {
                    GUILayout.Label("Step Complete!", VRCSdkControlPanel.infoGuiStyle);
                }
                else
                {
                    if (GUILayout.Button("Set Collision Matrix", GUILayout.Width(172)))
                    {
                        bool doIt = EditorUtility.DisplayDialog("Setup Collision Layer Matrix for VRChat",
                                                                "This will setup the correct physics collisions in the PhysicsManager for VRChat layers. Are you sure you want to continue?",
                                                                "Do it!", "Don't do it");
                        if (doIt)
                        {
                            UpdateLayers.SetupCollisionLayerMatrix();
                        }
                    }
                }

                GUILayout.EndVertical();
                GUILayout.EndHorizontal();
                GUILayout.EndVertical();
                GUILayout.Space(10);
            }

            return(mandatoryExpand);
        }
Beispiel #6
0
    void OnGUIScene(VRCSDK2.VRC_SceneDescriptor scene)
    {
        string lastUrl          = VRC_SdkBuilder.GetLastUrl();
        bool   lastBuildPresent = lastUrl != null;

        string worldVersion = "-1";

        PipelineManager[] pms = (PipelineManager[])VRC.Tools.FindSceneObjectsOfTypeAll <PipelineManager>();
        if (pms.Length == 1 && !string.IsNullOrEmpty(pms[0].blueprintId))
        {
            if (scene.apiWorld == null)
            {
                ApiWorld world = API.FromCacheOrNew <ApiWorld>(pms[0].blueprintId);
                world.Fetch(null, false,
                            (c) => scene.apiWorld = c.Model as ApiWorld,
                            (c) =>
                {
                    if (c.Code == 404)
                    {
                        Debug.LogErrorFormat("Could not load world {0} because it didn't exist.", pms[0].blueprintId);
                        ApiCache.Invalidate <ApiWorld>(pms[0].blueprintId);
                    }
                    else
                    {
                        Debug.LogErrorFormat("Could not load world {0} because {1}", pms[0].blueprintId, c.Error);
                    }
                });
                scene.apiWorld = world;
            }
            worldVersion = (scene.apiWorld as ApiWorld).version.ToString();
        }
        EditorGUILayout.LabelField("World Version: " + worldVersion);

        EditorGUILayout.Space();

        if (!UpdateLayers.AreLayersSetup() && GUILayout.Button("Setup Layers for VRChat"))
        {
            bool doIt = EditorUtility.DisplayDialog("Setup Layers for VRChat", "This adds all VRChat layers to your project and pushes any custom layers down the layer list. If you have custom layers assigned to gameObjects, you'll need to reassign them. Are you sure you want to continue?", "Do it!", "Don't do it");
            if (doIt)
            {
                UpdateLayers.SetupEditorLayers();
            }
        }

        if (UpdateLayers.AreLayersSetup() && !UpdateLayers.IsCollisionLayerMatrixSetup() && GUILayout.Button("Setup Collision Layer Matrix for VRChat"))
        {
            bool doIt = EditorUtility.DisplayDialog("Setup Collision Layer Matrix for VRChat", "This will setup the correct physics collisions in the PhysicsManager for VRChat layers. Are you sure you want to continue?", "Do it!", "Don't do it");
            if (doIt)
            {
                UpdateLayers.SetupCollisionLayerMatrix();
            }
        }

        scene.autoSpatializeAudioSources = EditorGUILayout.ToggleLeft("Apply 3D spatialization to AudioSources automatically at runtime (override settings by adding an ONSPAudioSource component to game object)", scene.autoSpatializeAudioSources);
        if (GUILayout.Button("Enable 3D spatialization on all 3D AudioSources in scene now"))
        {
            bool doIt = EditorUtility.DisplayDialog("Enable Spatialization", "This will add an ONSPAudioSource script to every 3D AudioSource in the current scene, and enable default settings for spatialization.  Are you sure you want to continue?", "Do it!", "Don't do it");
            if (doIt)
            {
                if (_EnableSpatialization != null)
                {
                    _EnableSpatialization();
                }
                else
                {
                    Debug.LogError("VrcSdkControlPanel: EnableSpatialization callback not found!");
                }
            }
        }

        GUI.enabled = (GUIErrors.Count == 0 && checkedForIssues);
        EditorGUILayout.Space();
        EditorGUILayout.BeginVertical();
        EditorGUILayout.LabelField("Test", EditorStyles.boldLabel);
        numClients = EditorGUILayout.IntField("Number of Clients", numClients);
        if (lastBuildPresent == false)
        {
            GUI.enabled = false;
        }
        if (GUILayout.Button("Last Build"))
        {
            VRC_SdkBuilder.shouldBuildUnityPackage = false;
            VRC_SdkBuilder.numClientsToLaunch      = numClients;
            VRC_SdkBuilder.RunLastExportedSceneResource();
        }
        if (APIUser.CurrentUser.hasSuperPowers)
        {
            if (GUILayout.Button("Copy Test URL"))
            {
                TextEditor te = new TextEditor();
                te.text = lastUrl;
                te.SelectAll();
                te.Copy();
            }
        }
        if (lastBuildPresent == false)
        {
            GUI.enabled = true;
        }
        if (GUILayout.Button("New Build"))
        {
            EnvConfig.ConfigurePlayerSettings();
            VRC_SdkBuilder.shouldBuildUnityPackage = false;
            VRC.AssetExporter.CleanupUnityPackageExport();  // force unity package rebuild on next publish
            VRC_SdkBuilder.numClientsToLaunch = numClients;
            VRC_SdkBuilder.PreBuildBehaviourPackaging();
            VRC_SdkBuilder.ExportSceneResourceAndRun();
        }
        EditorGUILayout.EndVertical();
        EditorGUILayout.Space();
        EditorGUILayout.BeginVertical();
        EditorGUILayout.LabelField("Publish", EditorStyles.boldLabel);
        if (lastBuildPresent == false)
        {
            GUI.enabled = false;
        }
        if (GUILayout.Button("Last Build"))
        {
            if (APIUser.CurrentUser.canPublishWorlds)
            {
                VRC_SdkBuilder.shouldBuildUnityPackage = VRC.AccountEditorWindow.FutureProofPublishEnabled;
                VRC_SdkBuilder.UploadLastExportedSceneBlueprint();
            }
            else
            {
                ShowContentPublishPermissionsDialog();
            }
        }
        if (lastBuildPresent == false)
        {
            GUI.enabled = true;
        }
        if (GUILayout.Button("New Build"))
        {
            if (APIUser.CurrentUser.canPublishWorlds)
            {
                EnvConfig.ConfigurePlayerSettings();
                VRC_SdkBuilder.shouldBuildUnityPackage = VRC.AccountEditorWindow.FutureProofPublishEnabled;
                VRC_SdkBuilder.PreBuildBehaviourPackaging();
                VRC_SdkBuilder.ExportAndUploadSceneBlueprint();
            }
            else
            {
                ShowContentPublishPermissionsDialog();
            }
        }
        EditorGUILayout.EndVertical();
        GUI.enabled = true;
    }
Beispiel #7
0
    void OnGUISceneCheck(VRCSDK2.VRC_SceneDescriptor scene)
    {
        CheckUploadChanges(scene);

        EditorGUILayout.InspectorTitlebar(true, scene.gameObject);

        if (VRC.Core.APIUser.CurrentUser != null && VRC.Core.APIUser.CurrentUser.hasScriptingAccess && !CustomDLLMaker.DoesScriptDirExist())
        {
            CustomDLLMaker.CreateDirectories();
        }

        Vector3 g = Physics.gravity;

        if (g.x != 0.0f || g.z != 0.0f)
        {
            OnGUIWarning(scene, "Gravity vector is not straight down. Though we support different gravity, player orientation is always 'upwards' so things don't always behave as you intend.");
        }
        if (g.y > 0)
        {
            OnGUIWarning(scene, "Gravity vector is not straight down, inverted or zero gravity will make walking extremely difficult.");
        }
        if (g.y == 0)
        {
            OnGUIWarning(scene, "Zero gravity will make walking extremely difficult, though we support different gravity, player orientation is always 'upwards' so this may not have the effect you're looking for.");
        }

        #if PLAYMAKER
        if (VRCSDK2.VRC_PlaymakerHelper.ValidatePlaymaker() == false)
        {
            OnGUIError(scene, VRCSDK2.VRC_PlaymakerHelper.GetErrors());
        }
        #endif

        if (!UpdateLayers.AreLayersSetup())
        {
            OnGUIError(scene, "Layers are not yet configured for VRChat. Please press the 'Setup Layers for VRChat' button above to apply layer settings and enable Test/Publish.");
        }

        if (UpdateLayers.AreLayersSetup() && !UpdateLayers.IsCollisionLayerMatrixSetup())
        {
            OnGUIError(scene, "Physics Collision Layer Matrix is not yet configured for VRChat. Please press the 'Setup Collision Layer Matrix for VRChat' button above to apply collision settings and enable Test/Publish.");
        }

        // warn those without scripting access if they choose to script locally
        if (VRC.Core.APIUser.CurrentUser != null && !VRC.Core.APIUser.CurrentUser.hasScriptingAccess && CustomDLLMaker.DoesScriptDirExist())
        {
            OnGUIWarning(scene, "Your account does not have permissions to upload custom scripts. You can test locally but need to contact VRChat to publish your world with scripts.");
        }

        foreach (VRCSDK2.VRC_DataStorage ds in GameObject.FindObjectsOfType <VRCSDK2.VRC_DataStorage>())
        {
            VRCSDK2.VRC_ObjectSync os = ds.GetComponent <VRCSDK2.VRC_ObjectSync>();
            if (os != null && os.SynchronizePhysics)
            {
                OnGUIWarning(scene, ds.name + " has a VRC_DataStorage and VRC_ObjectSync, with SynchronizePhysics enabled.");
            }
        }

        // auto create VRCScript dir for those with access
        if (VRC.Core.APIUser.CurrentUser != null && VRC.Core.APIUser.CurrentUser.hasScriptingAccess && !CustomDLLMaker.DoesScriptDirExist())
        {
            CustomDLLMaker.CreateDirectories();
        }

        if (scene.UpdateTimeInMS < (int)(1000f / 90f * 3f))
        {
            OnGUIWarning(scene, "Room has a very fast update rate; experience may suffer with many users.");
        }
    }