Search Unity

I moved Unity project folders from default when installing and now my editor has $$$$ the bed.

Discussion in 'Editor & General Support' started by Grinl, Sep 13, 2017.

  1. Grinl

    Grinl

    Joined:
    Sep 4, 2017
    Posts:
    17
    Alright. Story time.

    I have 2 HHDs and 1 SSD (very limited space)
    I had my unity installed in one of the HHDs but by accident I realized later that I made my projects in my User profile which is stored on the SSD. I began to quickly run out of space there.

    No problem I tried to move my projects to another folder but that for some reason I began getting a lot of errors. I said to myself its ok. Lets uninstall and lets reinstall.
    Well the problems continued.

    I keep getting errors like this when importing assets.
    Assets/Editor/Water (Pro Only)/Water4/WaterBaseEditor.cs(8,10): error CS0246: The type or namespace name `WaterBase' could not be found. Are you missing `UnityStandardAssets.Water' using directive?

    I then googled the problem and I got this.
    http://answers.unity3d.com/questions/316805/unityeditor-namespace-not-found.html

    I am no coder. What in the world am I suppose to do here?
    When I open the error it sends me to Microsoft Visual Studio which gives me the code below.
    I have over a dozen of these errors, even for standard asset imports. Why is Unity being so problematic? This is incredibly frustrating.
    Any help would be greatly appreciated.

    Code (CSharp):
    1. using UnityEngine;
    2. using UnityEditor;
    3.  
    4. [CustomEditor(typeof(WaterBase))]
    5. public class WaterBaseEditor : Editor
    6. {
    7.     public GameObject oceanBase;
    8.     private WaterBase waterBase;
    9.     private Material oceanMaterial = null;
    10.  
    11.     private SerializedObject serObj;
    12.     private SerializedProperty sharedMaterial;
    13.    
    14.  
    15.     public SerializedProperty waterQuality;
    16.     public SerializedProperty edgeBlend;
    17.  
    18.     public void OnEnable ()
    19.     {
    20.         serObj = new SerializedObject (target);
    21.         sharedMaterial = serObj.FindProperty("sharedMaterial");
    22.         waterQuality = serObj.FindProperty("waterQuality");
    23.         edgeBlend = serObj.FindProperty("edgeBlend");
    24.     }
    25.    
    26.     public override void OnInspectorGUI ()
    27.     {
    28.         serObj.Update();
    29.        
    30.         waterBase = (WaterBase)serObj.targetObject;
    31.         oceanBase = ((WaterBase)serObj.targetObject).gameObject;
    32.         if (!oceanBase)
    33.             return;
    34.            
    35.         GUILayout.Label ("This script helps adjusting water material properties", EditorStyles.miniBoldLabel);
    36.        
    37.         EditorGUILayout.PropertyField(sharedMaterial, new GUIContent("Material"));
    38.         oceanMaterial = (Material)sharedMaterial.objectReferenceValue;
    39.  
    40.         if (!oceanMaterial) {
    41.             sharedMaterial.objectReferenceValue = (Object)WaterEditorUtility.LocateValidWaterMaterial(oceanBase.transform);
    42.             serObj.ApplyModifiedProperties();
    43.             oceanMaterial = (Material)sharedMaterial.objectReferenceValue;
    44.             if (!oceanMaterial)
    45.                 return;
    46.         }
    47.        
    48.         EditorGUILayout.Separator ();
    49.        
    50.         GUILayout.Label ("Overall Quality", EditorStyles.boldLabel);
    51.         EditorGUILayout.PropertyField(waterQuality, new GUIContent("Quality"));
    52.         EditorGUILayout.PropertyField(edgeBlend, new GUIContent("Edge blend?"));
    53.        
    54.         if (waterQuality.intValue > (int)WaterQuality.Low && !SystemInfo.supportsRenderTextures)
    55.             EditorGUILayout.HelpBox("Water features not supported", MessageType.Warning);
    56.         if (edgeBlend.boolValue && !SystemInfo.SupportsRenderTextureFormat(RenderTextureFormat.Depth))
    57.             EditorGUILayout.HelpBox("Edge blend not supported", MessageType.Warning);
    58.        
    59.         EditorGUILayout.Separator ();
    60.        
    61.         bool hasShore = oceanMaterial.HasProperty("_ShoreTex");
    62.        
    63.         GUILayout.Label ("Main Colors", EditorStyles.boldLabel);
    64.         GUILayout.Label ("Alpha values define blending with realtime textures", EditorStyles.miniBoldLabel);
    65.  
    66.         WaterEditorUtility.SetMaterialColor("_BaseColor", EditorGUILayout.ColorField("Refraction", WaterEditorUtility.GetMaterialColor("_BaseColor", oceanMaterial)), oceanMaterial);
    67.         WaterEditorUtility.SetMaterialColor("_ReflectionColor", EditorGUILayout.ColorField("Reflection", WaterEditorUtility.GetMaterialColor("_ReflectionColor", oceanMaterial)), oceanMaterial);
    68.    
    69.         EditorGUILayout.Separator ();
    70.        
    71.         GUILayout.Label ("Main Textures", EditorStyles.boldLabel);
    72.         GUILayout.Label ("Used for small waves (bumps), foam and white caps", EditorStyles.miniBoldLabel);
    73.        
    74.         WaterEditorUtility.SetMaterialTexture("_BumpMap",(Texture)EditorGUILayout.ObjectField("Normals", WaterEditorUtility.GetMaterialTexture("_BumpMap", waterBase.sharedMaterial), typeof(Texture), false), waterBase.sharedMaterial);
    75.         if (hasShore)
    76.             WaterEditorUtility.SetMaterialTexture("_ShoreTex", (Texture)EditorGUILayout.ObjectField("Shore & Foam", WaterEditorUtility.GetMaterialTexture("_ShoreTex", waterBase.sharedMaterial), typeof(Texture), false), waterBase.sharedMaterial);
    77.  
    78.         Vector4 animationTiling;
    79.         Vector4 animationDirection;
    80.        
    81.         Vector2 firstTiling;
    82.         Vector2 secondTiling;
    83.         Vector2 firstDirection;
    84.         Vector2 secondDirection;
    85.    
    86.         animationTiling = WaterEditorUtility.GetMaterialVector("_BumpTiling", oceanMaterial);
    87.         animationDirection = WaterEditorUtility.GetMaterialVector("_BumpDirection", oceanMaterial);
    88.        
    89.         firstTiling = new Vector2(animationTiling.x*100.0F,animationTiling.y*100.0F);
    90.         secondTiling = new Vector2(animationTiling.z*100.0F,animationTiling.w*100.0F);
    91.        
    92.         firstTiling = EditorGUILayout.Vector2Field("Tiling 1", firstTiling);
    93.         secondTiling = EditorGUILayout.Vector2Field("Tiling 2", secondTiling);
    94.  
    95.         //firstTiling.x = EditorGUILayout.FloatField("1st Tiling U", firstTiling.x);
    96.         //firstTiling.y = EditorGUILayout.FloatField("1st Tiling V", firstTiling.y);
    97.         //secondTiling.x = EditorGUILayout.FloatField("2nd Tiling U", secondTiling.x);
    98.         //secondTiling.y = EditorGUILayout.FloatField("2nd Tiling V", secondTiling.y);
    99.        
    100.         firstDirection = new Vector2(animationDirection.x,animationDirection.y);
    101.         secondDirection = new Vector2(animationDirection.z,animationDirection.w);
    102.  
    103.         //firstDirection.x = EditorGUILayout.FloatField("1st Animation U", firstDirection.x);
    104.         //firstDirection.y = EditorGUILayout.FloatField("1st Animation V", firstDirection.y);
    105.         //secondDirection.x = EditorGUILayout.FloatField("2nd Animation U", secondDirection.x);
    106.         //secondDirection.y = EditorGUILayout.FloatField("2nd Animation V", secondDirection.y);
    107.        
    108.         firstDirection = EditorGUILayout.Vector2Field("Direction 1", firstDirection);
    109.         secondDirection = EditorGUILayout.Vector2Field("Direction 2", secondDirection);
    110.        
    111.         animationTiling = new Vector4(firstTiling.x/100.0F,firstTiling.y/100.0F, secondTiling.x/100.0F,secondTiling.y/100.0F);
    112.         animationDirection = new Vector4(firstDirection.x,firstDirection.y, secondDirection.x,secondDirection.y);
    113.        
    114.         WaterEditorUtility.SetMaterialVector("_BumpTiling", animationTiling, oceanMaterial);
    115.         WaterEditorUtility.SetMaterialVector("_BumpDirection", animationDirection, oceanMaterial);
    116.  
    117.         Vector4 displacementParameter = WaterEditorUtility.GetMaterialVector("_DistortParams", oceanMaterial);
    118.         Vector4 fade = WaterEditorUtility.GetMaterialVector("_InvFadeParemeter", oceanMaterial);
    119.  
    120.         EditorGUILayout.Separator ();
    121.  
    122.         GUILayout.Label ("Normals", EditorStyles.boldLabel);
    123.         GUILayout.Label ("Displacement for fresnel, specular and reflection/refraction", EditorStyles.miniBoldLabel);
    124.        
    125.         float gerstnerNormalIntensity = WaterEditorUtility.GetMaterialFloat("_GerstnerIntensity", oceanMaterial);
    126.         gerstnerNormalIntensity = EditorGUILayout.Slider("Per Vertex", gerstnerNormalIntensity, -2.5F, 2.5F);
    127.         WaterEditorUtility.SetMaterialFloat("_GerstnerIntensity", gerstnerNormalIntensity, oceanMaterial);
    128.        
    129.         displacementParameter.x = EditorGUILayout.Slider("Per Pixel", displacementParameter.x, -4.0F, 4.0F);
    130.         displacementParameter.y = EditorGUILayout.Slider("Distortion", displacementParameter.y, -0.5F, 0.5F);
    131.         // fade.z = EditorGUILayout.Slider("Distance fade", fade.z, 0.0f, 0.5f);
    132.        
    133.         EditorGUILayout.Separator ();
    134.        
    135.         GUILayout.Label ("Fresnel", EditorStyles.boldLabel);
    136.         GUILayout.Label ("Defines reflection to refraction relation", EditorStyles.miniBoldLabel);
    137.        
    138.         if (!oceanMaterial.HasProperty("_Fresnel")) {
    139.             if (oceanMaterial.HasProperty("_FresnelScale")) {
    140.                 float fresnelScale = EditorGUILayout.Slider("Intensity", WaterEditorUtility.GetMaterialFloat("_FresnelScale", oceanMaterial), 0.1F, 4.0F);
    141.                 WaterEditorUtility.SetMaterialFloat("_FresnelScale", fresnelScale, oceanMaterial);
    142.             }
    143.             displacementParameter.z = EditorGUILayout.Slider("Power", displacementParameter.z, 0.1F, 10.0F);
    144.             displacementParameter.w = EditorGUILayout.Slider("Bias", displacementParameter.w, -3.0F, 3.0F);
    145.         }
    146.         else
    147.         {
    148.             Texture fresnelTex = (Texture)EditorGUILayout.ObjectField(
    149.                     "Ramp",
    150.                     (Texture)WaterEditorUtility.GetMaterialTexture("_Fresnel",
    151.                     oceanMaterial),
    152.                     typeof(Texture),
    153.                     false);
    154.             WaterEditorUtility.SetMaterialTexture("_Fresnel", fresnelTex, oceanMaterial);
    155.         }
    156.        
    157.         EditorGUILayout.Separator ();
    158.        
    159.         WaterEditorUtility.SetMaterialVector("_DistortParams", displacementParameter, oceanMaterial);
    160.        
    161.         if (edgeBlend.boolValue)
    162.         {
    163.             GUILayout.Label ("Fading", EditorStyles.boldLabel);
    164.            
    165.             fade.x = EditorGUILayout.Slider("Edge fade", fade.x, 0.001f, 3.0f);
    166.             if (hasShore)
    167.                 fade.y = EditorGUILayout.Slider("Shore fade", fade.y, 0.001f, 3.0f);
    168.             fade.w = EditorGUILayout.Slider("Extinction fade", fade.w, 0.0f, 2.5f);
    169.  
    170.             WaterEditorUtility.SetMaterialVector("_InvFadeParemeter", fade, oceanMaterial);
    171.         }
    172.         EditorGUILayout.Separator ();
    173.        
    174.         if (oceanMaterial.HasProperty("_Foam")) {
    175.             GUILayout.Label ("Foam", EditorStyles.boldLabel);
    176.        
    177.             Vector4 foam = WaterEditorUtility.GetMaterialVector("_Foam", oceanMaterial);
    178.            
    179.             foam.x = EditorGUILayout.Slider("Intensity", foam.x, 0.0F, 1.0F);
    180.             foam.y = EditorGUILayout.Slider("Cutoff", foam.y, 0.0F, 1.0F);
    181.            
    182.             WaterEditorUtility.SetMaterialVector("_Foam", foam, oceanMaterial);
    183.         }
    184.        
    185.         serObj.ApplyModifiedProperties();
    186.     }
    187.  
    188. }
    189.  
     
  2. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    9,444
    It needs WaterBase.cs script somewhere in your project..

    Did you move the whole project root folder, or just parts of them?
    Did you update to different unity version?
     
  3. Grinl

    Grinl

    Joined:
    Sep 4, 2017
    Posts:
    17
    I already uninstalled it and reinstalled. I even made a new project.
     
  4. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    9,444
    Which package you imported to the empty new project?

    If you create new empty project, import Environment package, water works there.
    Which project/unity version the original project was?
     
  5. Grinl

    Grinl

    Joined:
    Sep 4, 2017
    Posts:
    17
    I really have no idea.
    this happened when I tried adding environment package.that I got this error.
     
  6. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    9,444
    it could be that you have old version of the water there, so should remove
    and import new from environment