Boat Attack使用了Universal RP的许多新图形功能,可以用于探索 Universal RP 的使用方式和技巧。
您最多选择25个主题 主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 
 

37 行
1.2 KiB

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Experimental.Rendering.LightweightPipeline;
namespace BoatAttack
{
/// <summary>
/// Used to lower the LOD bias on the planar reflections camera
/// <para>Needs to be replaced with SRP pass structure later</para>
/// </summary>
[ExecuteInEditMode]
public class LODTweaker : MonoBehaviour
{
/// <summary>
/// Check to see if rendering the planar reflection camera, if so, lower LOD bias
/// </summary>
/// <param name="cam">The currently rendering camera from LWRP</param>
void SetMaxLOD(Camera cam)
{
if (cam == Camera.main || cam.cameraType == CameraType.SceneView || cam.cameraType == CameraType.Reflection)
QualitySettings.lodBias = 3;
else
QualitySettings.lodBias = 0.5f;
}
void OnEnable()
{
LightweightPipeline.beginCameraRendering += SetMaxLOD; // listen for LWRP camera callback
}
void OnDisable()
{
LightweightPipeline.beginCameraRendering -= SetMaxLOD; // stop listening for LWRP camera callback
}
}
}