コード例 #1
0
 void OnEnable()
 {
     if (sync == null)
     {
         sync = (VRCSDK2.VRC_ObjectSync)target;
     }
 }
コード例 #2
0
 public override void OnInspectorGUI()
 {
     VRCSDK2.VRC_ObjectSync c = ((VRCSDK2.VRC_ObjectSync)target);
     if ((c.gameObject.GetComponent <Animator>() != null || c.gameObject.GetComponent <Animation>() != null) && c.SynchronizePhysics)
     {
         EditorGUILayout.HelpBox("If the Animator or Animation moves the root position of this object then it will conflict with physics synchronization.", MessageType.Warning);
     }
     DrawDefaultInspector();
 }
コード例 #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.");
        }

        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();
        }
    }
コード例 #4
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.");
        }
    }