[RESOLVIDO] erro WaterBaseEditor.cs não encontra o caminho do WaterBase
2 participantes
SchultzGames :: UNITY 3D :: Resolvidos
Página 1 de 1
[RESOLVIDO] erro WaterBaseEditor.cs não encontra o caminho do WaterBase
Finalmente terminei o meu Primeiro Game, vou dar Play para testar se esta tudo em seu devido lugar e...
Assets/Standard Assets/Editor/Water/Water4/WaterBaseEditor.cs(11,17): error CS0246: The type or namespace name `WaterBase' could not be found. Are you missing an assembly reference?
:/
Assets/Standard Assets/Editor/Water/Water4/WaterBaseEditor.cs(11,17): error CS0246: The type or namespace name `WaterBase' could not be found. Are you missing an assembly reference?
:/
Última edição por dstaroski em Qua Nov 07, 2018 5:56 pm, editado 1 vez(es) (Motivo da edição : Resolvido)
Re: [RESOLVIDO] erro WaterBaseEditor.cs não encontra o caminho do WaterBase
Daniel Dória escreveu:Finalmente terminei o meu Primeiro Game, vou dar Play para testar se esta tudo em seu devido lugar e...
Assets/Standard Assets/Editor/Water/Water4/WaterBaseEditor.cs(11,17): error CS0246: The type or namespace name `WaterBase' could not be found. Are you missing an assembly reference?
:/
- Código:
using UnityEngine;
using UnityEditor;
namespace UnityStandardAssets.Water
{
[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;
}
EditorGUILayout.Separator();
GUILayout.Label("Overall Quality", EditorStyles.boldLabel);
EditorGUILayout.PropertyField(waterQuality, new GUIContent("Quality"));
EditorGUILayout.PropertyField(edgeBlend, new GUIContent("Edge blend?"));
if (waterQuality.intValue > (int)WaterQuality.Low)
EditorGUILayout.HelpBox("Water features not supported", MessageType.Warning);
if (edgeBlend.boolValue && !SystemInfo.SupportsRenderTextureFormat(RenderTextureFormat.Depth))
EditorGUILayout.HelpBox("Edge blend not supported", MessageType.Warning);
EditorGUILayout.Separator();
bool hasShore = oceanMaterial.HasProperty("_ShoreTex");
GUILayout.Label("Main Colors", EditorStyles.boldLabel);
GUILayout.Label("Alpha values define blending with realtime textures", EditorStyles.miniBoldLabel);
WaterEditorUtility.SetMaterialColor("_BaseColor", EditorGUILayout.ColorField("Refraction", WaterEditorUtility.GetMaterialColor("_BaseColor", oceanMaterial)), oceanMaterial);
WaterEditorUtility.SetMaterialColor("_ReflectionColor", EditorGUILayout.ColorField("Reflection", WaterEditorUtility.GetMaterialColor("_ReflectionColor", oceanMaterial)), oceanMaterial);
EditorGUILayout.Separator();
GUILayout.Label("Main Textures", EditorStyles.boldLabel);
GUILayout.Label("Used for small waves (bumps), foam and white caps", EditorStyles.miniBoldLabel);
WaterEditorUtility.SetMaterialTexture("_BumpMap", (Texture)EditorGUILayout.ObjectField("Normals", WaterEditorUtility.GetMaterialTexture("_BumpMap", waterBase.sharedMaterial), typeof(Texture), false), waterBase.sharedMaterial);
if (hasShore)
WaterEditorUtility.SetMaterialTexture("_ShoreTex", (Texture)EditorGUILayout.ObjectField("Shore & Foam", WaterEditorUtility.GetMaterialTexture("_ShoreTex", waterBase.sharedMaterial), typeof(Texture), false), waterBase.sharedMaterial);
Vector4 animationTiling;
Vector4 animationDirection;
Vector2 firstTiling;
Vector2 secondTiling;
Vector2 firstDirection;
Vector2 secondDirection;
animationTiling = WaterEditorUtility.GetMaterialVector("_BumpTiling", oceanMaterial);
animationDirection = WaterEditorUtility.GetMaterialVector("_BumpDirection", oceanMaterial);
firstTiling = new Vector2(animationTiling.x * 100.0F, animationTiling.y * 100.0F);
secondTiling = new Vector2(animationTiling.z * 100.0F, animationTiling.w * 100.0F);
firstTiling = EditorGUILayout.Vector2Field("Tiling 1", firstTiling);
secondTiling = EditorGUILayout.Vector2Field("Tiling 2", secondTiling);
//firstTiling.x = EditorGUILayout.FloatField("1st Tiling U", firstTiling.x);
//firstTiling.y = EditorGUILayout.FloatField("1st Tiling V", firstTiling.y);
//secondTiling.x = EditorGUILayout.FloatField("2nd Tiling U", secondTiling.x);
//secondTiling.y = EditorGUILayout.FloatField("2nd Tiling V", secondTiling.y);
firstDirection = new Vector2(animationDirection.x, animationDirection.y);
secondDirection = new Vector2(animationDirection.z, animationDirection.w);
//firstDirection.x = EditorGUILayout.FloatField("1st Animation U", firstDirection.x);
//firstDirection.y = EditorGUILayout.FloatField("1st Animation V", firstDirection.y);
//secondDirection.x = EditorGUILayout.FloatField("2nd Animation U", secondDirection.x);
//secondDirection.y = EditorGUILayout.FloatField("2nd Animation V", secondDirection.y);
firstDirection = EditorGUILayout.Vector2Field("Direction 1", firstDirection);
secondDirection = EditorGUILayout.Vector2Field("Direction 2", secondDirection);
animationTiling = new Vector4(firstTiling.x / 100.0F, firstTiling.y / 100.0F, secondTiling.x / 100.0F, secondTiling.y / 100.0F);
animationDirection = new Vector4(firstDirection.x, firstDirection.y, secondDirection.x, secondDirection.y);
WaterEditorUtility.SetMaterialVector("_BumpTiling", animationTiling, oceanMaterial);
WaterEditorUtility.SetMaterialVector("_BumpDirection", animationDirection, oceanMaterial);
Vector4 displacementParameter = WaterEditorUtility.GetMaterialVector("_DistortParams", oceanMaterial);
Vector4 fade = WaterEditorUtility.GetMaterialVector("_InvFadeParemeter", oceanMaterial);
EditorGUILayout.Separator();
GUILayout.Label("Normals", EditorStyles.boldLabel);
GUILayout.Label("Displacement for fresnel, specular and reflection/refraction", EditorStyles.miniBoldLabel);
float gerstnerNormalIntensity = WaterEditorUtility.GetMaterialFloat("_GerstnerIntensity", oceanMaterial);
gerstnerNormalIntensity = EditorGUILayout.Slider("Per Vertex", gerstnerNormalIntensity, -2.5F, 2.5F);
WaterEditorUtility.SetMaterialFloat("_GerstnerIntensity", gerstnerNormalIntensity, oceanMaterial);
displacementParameter.x = EditorGUILayout.Slider("Per Pixel", displacementParameter.x, -4.0F, 4.0F);
displacementParameter.y = EditorGUILayout.Slider("Distortion", displacementParameter.y, -0.5F, 0.5F);
// fade.z = EditorGUILayout.Slider("Distance fade", fade.z, 0.0f, 0.5f);
EditorGUILayout.Separator();
GUILayout.Label("Fresnel", EditorStyles.boldLabel);
GUILayout.Label("Defines reflection to refraction relation", EditorStyles.miniBoldLabel);
if (!oceanMaterial.HasProperty("_Fresnel"))
{
if (oceanMaterial.HasProperty("_FresnelScale"))
{
float fresnelScale = EditorGUILayout.Slider("Intensity", WaterEditorUtility.GetMaterialFloat("_FresnelScale", oceanMaterial), 0.1F, 4.0F);
WaterEditorUtility.SetMaterialFloat("_FresnelScale", fresnelScale, oceanMaterial);
}
displacementParameter.z = EditorGUILayout.Slider("Power", displacementParameter.z, 0.1F, 10.0F);
displacementParameter.w = EditorGUILayout.Slider("Bias", displacementParameter.w, -3.0F, 3.0F);
}
else
{
Texture fresnelTex = (Texture)EditorGUILayout.ObjectField(
"Ramp",
(Texture)WaterEditorUtility.GetMaterialTexture("_Fresnel",
oceanMaterial),
typeof(Texture),
false);
WaterEditorUtility.SetMaterialTexture("_Fresnel", fresnelTex, oceanMaterial);
}
EditorGUILayout.Separator();
WaterEditorUtility.SetMaterialVector("_DistortParams", displacementParameter, oceanMaterial);
if (edgeBlend.boolValue)
{
GUILayout.Label("Fading", EditorStyles.boldLabel);
fade.x = EditorGUILayout.Slider("Edge fade", fade.x, 0.001f, 3.0f);
if (hasShore)
fade.y = EditorGUILayout.Slider("Shore fade", fade.y, 0.001f, 3.0f);
fade.w = EditorGUILayout.Slider("Extinction fade", fade.w, 0.0f, 2.5f);
WaterEditorUtility.SetMaterialVector("_InvFadeParemeter", fade, oceanMaterial);
}
EditorGUILayout.Separator();
if (oceanMaterial.HasProperty("_Foam"))
{
GUILayout.Label("Foam", EditorStyles.boldLabel);
Vector4 foam = WaterEditorUtility.GetMaterialVector("_Foam", oceanMaterial);
foam.x = EditorGUILayout.Slider("Intensity", foam.x, 0.0F, 1.0F);
foam.y = EditorGUILayout.Slider("Cutoff", foam.y, 0.0F, 1.0F);
WaterEditorUtility.SetMaterialVector("_Foam", foam, oceanMaterial);
}
serObj.ApplyModifiedProperties();
}
}
}
- Código:
using System;
using UnityEngine;
namespace UnityStandardAssets.Water
{
public enum WaterQuality
{
High = 2,
Medium = 1,
Low = 0,
}
[ExecuteInEditMode]
public class WaterBase : MonoBehaviour
{
public Material sharedMaterial;
public WaterQuality waterQuality = WaterQuality.High;
public bool edgeBlend = true;
public void UpdateShader()
{
if (waterQuality > WaterQuality.Medium)
{
sharedMaterial.shader.maximumLOD = 501;
}
else if (waterQuality > WaterQuality.Low)
{
sharedMaterial.shader.maximumLOD = 301;
}
else
{
sharedMaterial.shader.maximumLOD = 201;
}
// If the system does not support depth textures (ie. NaCl), turn off edge bleeding,
// as the shader will render everything as transparent if the depth texture is not valid.
if (!SystemInfo.SupportsRenderTextureFormat(RenderTextureFormat.Depth))
{
edgeBlend = false;
}
if (edgeBlend)
{
Shader.EnableKeyword("WATER_EDGEBLEND_ON");
Shader.DisableKeyword("WATER_EDGEBLEND_OFF");
// just to make sure (some peeps might forget to add a water tile to the patches)
if (Camera.main)
{
Camera.main.depthTextureMode |= DepthTextureMode.Depth;
}
}
else
{
Shader.EnableKeyword("WATER_EDGEBLEND_OFF");
Shader.DisableKeyword("WATER_EDGEBLEND_ON");
}
}
public void WaterTileBeingRendered(Transform tr, Camera currentCam)
{
if (currentCam && edgeBlend)
{
currentCam.depthTextureMode |= DepthTextureMode.Depth;
}
}
public void Update()
{
if (sharedMaterial)
{
UpdateShader();
}
}
}
}
Re: [RESOLVIDO] erro WaterBaseEditor.cs não encontra o caminho do WaterBase
não sei o que fiz que o erro do water base sumiu mas para compensar surgiu mais 6 erros do mesmo motivo com "GerstnerDisplaceEditor", "PlanarReflectionEditor" e "SpecularLightingEditor" tudo isso é scripts na pasta do standard assets/water4 aconteceu quando fiz update no assetstore e acredito que esses erros se trata de encontrar o script de mesmo nome sem 'editor' como falei no titulo, e esses scripts sem 'editor' no final fazem parte de um asset comprado separadamente.
Re: [RESOLVIDO] erro WaterBaseEditor.cs não encontra o caminho do WaterBase
o Water base fica no pakage Everioment reinporta o pacote denovo
francisco barroso- Programador
- PONTOS : 2613
REPUTAÇÃO : 59
Respeito as regras :
Re: [RESOLVIDO] erro WaterBaseEditor.cs não encontra o caminho do WaterBase
eu pensei que havia atualizado esse tópico mas ai vai a solução: Descobri todos os scripts repetidos e apaguei os de caminho Standard Assets era isso, fiz outras edições lá dentro do script em alguns casos mas já esqueci como foi.
Tópicos semelhantes
» [RESOLVIDO] Erro Som.
» [RESOLVIDO] Erro no Baú
» [RESOLVIDO] Erro
» [RESOLVIDO] erro de dll's
» [RESOLVIDO] Erro colider
» [RESOLVIDO] Erro no Baú
» [RESOLVIDO] Erro
» [RESOLVIDO] erro de dll's
» [RESOLVIDO] Erro colider
SchultzGames :: UNITY 3D :: Resolvidos
Página 1 de 1
Permissões neste sub-fórum
Não podes responder a tópicos