您最多选择25个主题
主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
38 行
792 B
38 行
792 B
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using UnityEngine.Experimental.Rendering.LightweightPipeline;
|
|
|
|
[ExecuteInEditMode]
|
|
public class ShadowOnlyPass : MonoBehaviour {
|
|
|
|
private Light _light;
|
|
|
|
void Start()
|
|
{
|
|
_light = GetComponent<Light>();
|
|
}
|
|
|
|
void ShadowCheck(Camera cam)
|
|
{
|
|
if (_light)
|
|
{
|
|
if (cam == Camera.main)
|
|
_light.shadows = LightShadows.Soft;
|
|
else
|
|
_light.shadows = LightShadows.None;
|
|
}
|
|
}
|
|
|
|
void OnEnable()
|
|
{
|
|
LightweightPipeline.beginCameraRendering += ShadowCheck;
|
|
}
|
|
|
|
// Cleanup all the objects we possibly have created
|
|
void OnDisable()
|
|
{
|
|
LightweightPipeline.beginCameraRendering -= ShadowCheck;
|
|
}
|
|
|
|
}
|