コード例 #1
0
        public override void OnInspectorGUI()
        {
            if (water.transform.rotation != Quaternion.identity)
            {
                string warning = "The water object is designed to work without rotation. Some features may not work correctly.";
                EditorGUILayout.LabelField(warning, PEditorCommon.WarningLabel);
            }

            water.Profile = PEditorCommon.ScriptableObjectField <PWaterProfile>("Profile", water.Profile);
            profile       = water.Profile;
            if (water.Profile == null)
            {
                return;
            }
            so = new SerializedObject(profile);
            reflectionLayersSO = so.FindProperty("reflectionLayers");
            refractionLayersSO = so.FindProperty("refractionLayers");

            EditorGUI.BeginChangeCheck();
            DrawMeshSettingsGUI();
            DrawRenderingSettingsGUI();
            DrawColorsSettingsGUI();
            DrawFresnelSettingsGUI();
            DrawRippleSettingsGUI();
            DrawWaveSettingsGUI();
            DrawLightAbsorbtionSettingsGUI();
            DrawFoamSettingsGUI();
            DrawReflectionSettings();
            DrawRefractionSettings();
            DrawCausticSettings();

            if (EditorGUI.EndChangeCheck())
            {
                EditorUtility.SetDirty(profile);
                water.UpdateMaterial();
            }

            DrawEffectsGUI();
            if (willDrawDebugGUI)
            {
                DrawDebugGUI();
            }

            if (so != null)
            {
                so.Dispose();
            }

            if (reflectionLayersSO != null)
            {
                reflectionLayersSO.Dispose();
            }

            if (refractionLayersSO != null)
            {
                refractionLayersSO.Dispose();
            }
        }
コード例 #2
0
        public override void OnInspectorGUI()
        {
            bool   willDrawGUI = false;
            string msg         = null;

            if (PCommon.CurrentRenderPipeline == PRenderPipelineType.Builtin)
            {
#if UNITY_POST_PROCESSING_STACK_V2
                willDrawGUI = true;
#else
                msg = "Please install Post Processing Stack V2 to setup water effect";
#endif
            }
            else if (PCommon.CurrentRenderPipeline == PRenderPipelineType.Universal)
            {
#if POSEIDON_URP
                willDrawGUI = true;
#endif
            }
            else
            {
                willDrawGUI = false;
                msg         = "Water effect doesn't support custom render pipeline.";
            }

            if (!willDrawGUI)
            {
                EditorGUILayout.LabelField(msg, PEditorCommon.WordWrapItalicLabel);
                return;
            }

#if POSEIDON_URP
            if (PCommon.CurrentRenderPipeline == PRenderPipelineType.Universal)
            {
                if (!CheckRendererFeatureConfig())
                {
                    EditorGUILayout.LabelField("Please add a Water Effect Renderer Feature to the current URP Asset to setup water effect.", PEditorCommon.WordWrapItalicLabel);
                    return;
                }
            }
#endif

            instance.Water   = EditorGUILayout.ObjectField("Water", instance.Water, typeof(PWater), true) as PWater;
            instance.Profile = PEditorCommon.ScriptableObjectField <PWaterFXProfile>("Profile", instance.Profile);

            if (instance.Water == null || instance.Profile == null)
            {
                return;
            }
            DrawVolumesGUI();
            EditorGUI.BeginChangeCheck();
            PWaterFXProfileInspectorDrawer.Create(instance.Profile, instance.Water).DrawGUI();
            if (EditorGUI.EndChangeCheck())
            {
                instance.UpdatePostProcessOrVolumeProfile();
            }
            DrawEventsGUI();
        }