title: Unity 2019 error The type or namespace name 'NotSupportedException' could not be found (are you missing a using directive or an assembly reference?)
body: <p>The type or namespace name 'NotSupportedException' could not be found (are you missing a using directive or an assembly reference?)
  error only happens in unity when trying to compile. in visual studio does not show error messages
  I tried to look for solutions but nothing worked, could someone help me solve this problem?
  how to solve?</p>
  
  <p>error Assets\HeroEditor4D\Common\EditorScripts\CharacterEditor.cs(141,23): error CS0246: The type or namespace name 'NotSupportedException' could not be found (are you missing a using directive or an assembly reference?)</p>
  
  <pre><code>    #else
  
      public override void Save(string path)
      {
          throw new NotSupportedException();
      }
  
      public override void Load(string path)
      {
  LINE ERROR        throw new NotSupportedException();
      }
  
      #endif
  </code></pre>
  
  <p>-</p>
  
  <pre><code>using Assets.HeroEditor4D.Common.CharacterScripts;
  using HeroEditor.Common;
  using UnityEngine;
  
  namespace Assets.HeroEditor4D.Common.EditorScripts
  {
      /// &lt;summary&gt;
      /// Character editor UI and behaviour.
      /// &lt;/summary&gt;
      public class CharacterEditor : CharacterEditorBase
      {
          [Header("Other")]
          public bool UseEditorColorField = true;
          public string PrefabFolder;
          public string TestRoomSceneName;
  
          private static Character _temp;
  
          /// &lt;summary&gt;
          /// Called automatically on app start.
          /// &lt;/summary&gt;
          public void Awake()
          {
              RestoreTempCharacter();
          }
  
          public void OnValidate()
          {
              if (Character == null)
              {
                  Character = FindObjectOfType&lt;Character4D&gt;();
              }
          }
  
          /// &lt;summary&gt;
          /// Remove all equipment.
          /// &lt;/summary&gt;
          public void Reset()
          {
              Character.Parts.ForEach(i =&gt; i.ResetEquipment());
              InitializeDropdowns();
          }
  
          #if UNITY_EDITOR
  
          /// &lt;summary&gt;
          /// Save character to prefab.
          /// &lt;/summary&gt;
          public void Save()
          {
              PrefabFolder = UnityEditor.EditorUtility.SaveFilePanel("Save character prefab", PrefabFolder, "New character", "prefab");
  
              if (PrefabFolder.Length &gt; 0)
              {
                  Save("Assets" + PrefabFolder.Replace(Application.dataPath, null));
              }
          }
  
          /// &lt;summary&gt;
          /// Load character from prefab.
          /// &lt;/summary&gt;
          public void Load()
          {
              PrefabFolder = UnityEditor.EditorUtility.OpenFilePanel("Load character prefab", PrefabFolder, "prefab");
  
              if (PrefabFolder.Length &gt; 0)
              {
                  Load("Assets" + PrefabFolder.Replace(Application.dataPath, null));
              }
  
              //FeatureTip();
          }
  
          /// &lt;summary&gt;
          /// Save character to json.
          /// &lt;/summary&gt;
          public void SaveToJson()
          {
              PrefabFolder = UnityEditor.EditorUtility.SaveFilePanel("Save character to json", PrefabFolder, "New character", "json");
  
              if (PrefabFolder.Length &gt; 0)
              {
                  var path = "Assets" + PrefabFolder.Replace(Application.dataPath, null);
                  var json = Character.ToJson();
  
                  System.IO.File.WriteAllText(path, json);
                  Debug.LogFormat("Json saved to {0}: {1}", path, json);
              }
  
              //FeatureTip();
          }
  
          /// &lt;summary&gt;
          /// Load character from json.
          /// &lt;/summary&gt;
          public void LoadFromJson()
          {
              PrefabFolder = UnityEditor.EditorUtility.OpenFilePanel("Load character from json", PrefabFolder, "json");
  
              if (PrefabFolder.Length &gt; 0)
              {
                  var path = "Assets" + PrefabFolder.Replace(Application.dataPath, null);
                  var json = System.IO.File.ReadAllText(path);
  
                  Character.LoadFromJson(json);
              }
  
              //FeatureTip();
          }
  
          public override void Save(string path)
          {
              Character.transform.localScale = Vector3.one;
  
              #if UNITY_2018_3_OR_NEWER
  
              UnityEditor.PrefabUtility.SaveAsPrefabAsset(Character.gameObject, path);
  
              #else
  
              UnityEditor.PrefabUtility.CreatePrefab(path, Character.gameObject);
  
              #endif
  
              Debug.LogFormat("Prefab saved as {0}", path);
          }
  
          public override void Load(string path)
          {
              var character = UnityEditor.AssetDatabase.LoadAssetAtPath&lt;Character4D&gt;(path);
  
              //Character.GetComponent&lt;Character&gt;().Firearm.Params = character.Firearm.Params; // TODO: Workaround
              Load(character);
              //FindObjectOfType&lt;CharacterBodySculptor&gt;().OnCharacterLoaded(character);
          }
  
          #else
  
          public override void Save(string path)
          {
              throw new NotSupportedException();
          }
  
          public override void Load(string path)
          {
              throw new NotSupportedException();
          }
  
          #endif
  
          /// &lt;summary&gt;
          /// Test character with demo setup.
          /// &lt;/summary&gt;
          public void Test()
          {
              //#if UNITY_EDITOR
  
              //if (UnityEditor.EditorBuildSettings.scenes.All(i =&gt; !i.path.Contains(TestRoomSceneName)))
              //{
              //  UnityEditor.EditorUtility.DisplayDialog("HeroView Editor", string.Format("Please add '{0}.scene' to Build Settings!", TestRoomSceneName), "OK");
              //  return;
              //}
  
              //#endif
  
              //var controller = Character.gameObject.AddComponent&lt;CharacterController&gt;();
  
              //controller.center = new Vector3(0, 1.125f);
              //controller.height = 2.5f;
              //controller.radius = 0.75f;
              //Character.GetComponent&lt;WeaponControls&gt;().enabled = true;
              //Character.gameObject.AddComponent&lt;CharacterControl&gt;();
              //DontDestroyOnLoad(Character);
              //_temp = Character as Character;
              //SceneManager.LoadScene(TestRoomSceneName);
  
              //FeatureTip();
          }
  
          protected override void OpenPalette(GameObject palette, Color selected)
          {
              #if UNITY_EDITOR_WIN
  
              if (UseEditorColorField)
              {
                  EditorColorField.Open(selected);
              }
              else
  
              #endif
  
              {
                  Editor.SetActive(false);
                  palette.SetActive(true);
              }
          }
  
          private void RestoreTempCharacter()
          {
              //if (_temp == null) return;
  
              //Character.GetComponent&lt;Character&gt;().Firearm.Params = _temp.Firearm.Params; // TODO: Workaround
              //Load(_temp);
              //FindObjectOfType&lt;CharacterBodySculptor&gt;().OnCharacterLoaded(_temp);
              //Destroy(_temp.gameObject);
              //_temp = null;
          }
  
          protected override void FeedbackTip()
          {
              #if UNITY_EDITOR
  
              var success = UnityEditor.EditorUtility.DisplayDialog("HeroView Editor", "Hi! Thank you for using my asset! I hope you enjoy making your game with it. The only thing I would ask you to do is to leave a review on the Asset Store. It would be awasome support for my asset, thanks!", "Review", "Later");
  
              RequestFeedbackResult(success, false);
  
              #endif
          }
  
          private void FeatureTip()
          {
              #if UNITY_EDITOR
  
              if (UnityEditor.EditorUtility.DisplayDialog("HeroView Editor", "This feature is available only in PRO asset version!", "Navigate", "Cancel"))
              {
                  Application.OpenURL(LinkToProVersion);
              }
  
              #endif
          }
      }
  }
  </code></pre>