/// <summary>
 /// アクティブになった時に呼び出されます
 /// </summary>
 public override void OnActivate(string searchContext, VisualElement rootElement)
 {
     m_settings                  = PlatformCheckerSettings.Load();
     m_serializedObject          = new SerializedObject(m_settings);
     m_buildTargetGroupsProperty = m_serializedObject.FindProperty("m_buildTargetGroups");
     m_logLevelProperty          = m_serializedObject.FindProperty("m_logLevel");
     m_messageProperty           = m_serializedObject.FindProperty("m_message");
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Unity エディタの現在のプラットフォームが正しいか確認します
        /// </summary>
        private static void Check()
        {
            var settings = PlatformCheckerSettings.Load();

            if (settings == null)
            {
                return;
            }

            var buildTargetGroups = settings.BuildTargetGroups;

            if (buildTargetGroups == null || buildTargetGroups.Count <= 0)
            {
                return;
            }

            var activeBuildTarget = EditorUserBuildSettings.activeBuildTarget;
            var buildTargetGroup  = BuildPipeline.GetBuildTargetGroup(activeBuildTarget);

            if (buildTargetGroups.Contains(buildTargetGroup))
            {
                return;
            }

            var logLevel = settings.LogLevel;
            var message  = settings.Message;

            switch (logLevel)
            {
            case LogLevel.INFO:
                Debug.Log(message);
                break;

            case LogLevel.WARNING:
                Debug.LogWarning(message);
                break;

            case LogLevel.ERROR:
                Debug.LogError(message);
                break;

            default: throw new ArgumentOutOfRangeException();
            }
        }