How do I fix this WaterBase error?
Hi everyone! Before starting, I know it’s possible that this question was made by another user, but I didn’t found a solution for me, so I’m posting to see if someone could help me to solve this. I’ve started following a 2d platformer course a week ago. I’m not a developer, I’m just learning and using my art to make a game, but everything was going fine until this happened.
I was playing arround with the particles to make a cool respawning effect, and I don’t remember why (I suposse it was because an error that showed) deleted a water script That obviously gave me a big error, so after hours of trying things, figured how to reimport that script. But now I have this error:
Assets/Standard Assets/Effects/ImageEffects/Editor/Water (Pro Only)/WaterBaseEditor.cs(8,13): error CS0246: The type or namespace name WaterBase' could not be found. Are you missing
UnityStandardAssets.Water' using directive?
I was very happy with the results, but now I'm stuck here and I'm not able to find a solution (Spent days searching on the internet, but 0 luck) And the waterbase files are on their places, I don't get it.
Can somebody help me please?
Here's the part of the code where the problem is supossed to be:
using UnityEngine;
using UnityEditor;
[CustomEditor(typeof(WaterBase))]
public class WaterBaseEditor : Editor
{
public GameObject oceanBase;
private WaterBase waterBase;
private Material oceanMaterial = null;
private SerializedObject serObj;
private SerializedProperty sharedMaterial;
public SerializedProperty waterQuality;
public SerializedProperty edgeBlend;
public void OnEnable ()
{
serObj = new SerializedObject (target);
sharedMaterial = serObj.FindProperty("sharedMaterial");
waterQuality = serObj.FindProperty("waterQuality");
edgeBlend = serObj.FindProperty("edgeBlend");
}
public override void OnInspectorGUI ()
{
serObj.Update();
waterBase = (WaterBase)serObj.targetObject;
oceanBase = ((WaterBase)serObj.targetObject).gameObject;
if(!oceanBase)
return;
GUILayout.Label ("This script helps adjusting water material properties", EditorStyles.miniBoldLabel);
EditorGUILayout.PropertyField(sharedMaterial, new GUIContent("Material"));
oceanMaterial = (Material)sharedMaterial.objectReferenceValue;
if (!oceanMaterial) {
sharedMaterial.objectReferenceValue = (Object)WaterEditorUtility.LocateValidWaterMaterial(oceanBase.transform);
serObj.ApplyModifiedProperties();
oceanMaterial = (Material)sharedMaterial.objectReferenceValue;
if (!oceanMaterial)
return;
}
$$anonymous$$ake sure that you also import the "Water" sub-folder from the "Environment" folder of the Standard assets
Answer by sdclark79 · Jul 23, 2018 at 11:33 PM
Adding "using UnityStandardAssets.Water" will not work, the namespace is already referencing that. RodBeta2 has the right link, but it doesn't spell anything out. My solution, based on RobBeta2s link was to move the whole Editor folder out of StandardAssets and make it a top-level directory (Assets -> Editor).
Yep, this worked for me too, by moving the Editor folder into the Assets folder.
Answer by FeoGarra · Sep 03, 2018 at 10:11 AM
Make sure that you also import the "Water" sub-folder from the "Environment" folder of the Standard assets
Answer by RodBeta2 · Oct 01, 2017 at 04:50 PM
I have the same problem today.
Refer to https://docs.unity3d.com/Manual/ScriptCompileOrderFolders.html
You can move the dictionary "Assets\Malbers Animations" (Which contains WaterBase class) to "Assets\Standard Assets\Malbers Animations"
Answer by Nelson96 · Jul 30, 2017 at 04:49 PM
If you are still having this problem, I fixed mine by adding using UnityStandardAssets.Water;
Answer by JustThommie · Sep 26, 2017 at 11:44 AM
I have the same problem, but its not working with ''using UnityStandardAssets.Water;''.
Can you help me.
Thanks
Greetings,
Thomas