コード例 #1
0
ファイル: EditorVR.cs プロジェクト: qipa/EditorVR
		static EditorVR()
		{
			ObjectUtils.hideFlags = defaultHideFlags;

			if (!PlayerSettings.virtualRealitySupported)
				Debug.Log("<color=orange>EditorVR requires VR support. Please check Virtual Reality Supported in Edit->Project Settings->Player->Other Settings</color>");

#if !ENABLE_OVR_INPUT && !ENABLE_STEAMVR_INPUT && !ENABLE_SIXENSE_INPUT
			Debug.Log("<color=orange>EditorVR requires at least one partner (e.g. Oculus, Vive) SDK to be installed for input. You can download these from the Asset Store or from the partner's website</color>");
#endif

			// Add EVR tags and layers if they don't exist
			var tags = TagManager.GetRequiredTags();
			var layers = TagManager.GetRequiredLayers();

			foreach (var tag in tags)
			{
				TagManager.AddTag(tag);
			}

			foreach (var layer in layers)
			{
				TagManager.AddLayer(layer);
			}
		}
コード例 #2
0
ファイル: SceneLOD.cs プロジェクト: xybyte/AutoLOD
        void OnEnable()
        {
#if UNITY_2017_3_OR_NEWER
            if (LayerMask.NameToLayer(LODVolume.HLODLayer) == -1)
            {
                var layers = TagManager.GetRequiredLayers();
                foreach (var layer in layers)
                {
                    TagManager.AddLayer(layer);
                }
            }

            if (LayerMask.NameToLayer(LODVolume.HLODLayer) != -1)
            {
                Tools.lockedLayers |= LayerMask.GetMask(LODVolume.HLODLayer);
                s_Activated         = true;
            }

            if (s_Activated)
            {
                AddCallbacks();
            }

            ResetServiceCoroutineQueue();
#endif
        }
コード例 #3
0
        void OnEnable()
        {
#if UNITY_2017_3_OR_NEWER
            if (LayerMask.NameToLayer(LODVolume.HLODLayer) == -1)
            {
                Dbg.LogWarning("Adding missing HLOD layer");

                var layers = TagManager.GetRequiredLayers();
                foreach (var layer in layers)
                {
                    TagManager.AddLayer(layer);
                }
            }

            if (LayerMask.NameToLayer(LODVolume.HLODLayer) != -1)
            {
                Tools.lockedLayers |= LayerMask.GetMask(LODVolume.HLODLayer);
                s_Activated         = true;
            }

            if (s_Activated)
            {
                AddCallbacks();
            }

            m_ServiceCoroutineQueue = null;
#endif
        }
コード例 #4
0
    public static void ShowMissingTagsAndLayersDialog(string[] tags, string[] layers)
    {
        List <string> missingTags   = CheckMissingTags(tags);
        List <string> missingLayers = CheckMissingLayers(layers);

        // No missing tags and layers, nothing to do
        if (missingTags.Count == 0 && missingLayers.Count == 0)
        {
            return;
        }

        StringBuilder sb = new StringBuilder();
        string        title;

        // Constructing the dialog message
        sb.Append("In order to use Dynamic Water System, you have to add following ");
        if (missingTags.Count != 0 && missingLayers.Count == 0)
        {
            sb.Append("tags");
            title = "Missing tags";
        }
        else if (missingTags.Count == 0 && missingLayers.Count != 0)
        {
            sb.Append("layers");
            title = "Missing layers";
        }
        else
        {
            sb.Append("tags and layers");
            title = "Missing tags and layers";
        }

        sb.Append(":\n\n");

        if (missingTags.Count != 0)
        {
            sb.Append("Tags:\n");
            foreach (string missingTag in missingTags)
            {
                sb.AppendFormat("- {0}\n", missingTag);
            }

            sb.Append("\n");
        }

        if (missingLayers.Count != 0)
        {
            sb.Append("Layers:\n");
            foreach (string missingLayer in missingLayers)
            {
                sb.AppendFormat("- {0}\n", missingLayer);
            }

            sb.Append("\n");
        }

        string consoleMessage = sb.ToString();

        sb.Append("Do you want to add them automatically?");

        if (EditorUtility.DisplayDialog(title, sb.ToString(), "Add", "Cancel"))
        {
            foreach (string missingTag in missingTags)
            {
                TagManager.AddTag(missingTag);
            }

            foreach (string missingLayer in missingLayers)
            {
                TagManager.AddLayer(missingLayer);
            }
        }
        else
        {
            Debug.LogWarning(consoleMessage);
        }
    }