void UpdateTriggerButtons(WebTrigger webTrigger)
 {
     triggersRoot.Clear();
     if (trigger == null)
     {
         return;
     }
     foreach (var trigger in webTrigger.triggers)
     {
         triggersRoot.Add(GenerateTriggerButton(trigger));
     }
 }
        void LoadJsonTrigger()
        {
            var filePath = EditorUtility.OpenFilePanel("JSONを読み込む", "", "json");

            if (string.IsNullOrEmpty(filePath))
            {
                return;
            }
            if (TryLoadTriggerJson(filePath, out var trigger))
            {
                this.trigger = trigger;
                UpdateTriggerButtons(trigger);
            }
        }
 static bool TryLoadTriggerJson(string filePath, out WebTrigger trigger)
 {
     try
     {
         trigger = JsonUtility.FromJson <WebTrigger>(File.ReadAllText(filePath));
         return(Validate(trigger));
     }
     catch (Exception e)
     {
         Debug.LogException(e);
         trigger = default;
         return(false);
     }
 }
        static bool Validate(WebTrigger webTrigger)
        {
            bool valid = true;

            foreach (var trigger in webTrigger.triggers)
            {
                foreach (var state in trigger.state)
                {
                    if (!TryGetStateValue(state.type, state.value, default, out _))
                    {
                        Debug.LogError($"{trigger.displayName}の{state.key}のValueのパースに失敗しました");
                        valid = false;
                    }
                }
            }

            return(valid);
        }