35 lines
972 B
Plaintext
35 lines
972 B
Plaintext
using UnityEngine;
|
|
using UnityEngine.Rendering.Universal;
|
|
|
|
namespace CommunityModules
|
|
{
|
|
/// <summary>
|
|
/// Use this component to set some unity settings for your world
|
|
/// </summary>
|
|
public class UnitySettings : MonoBehaviour
|
|
{
|
|
[Range(1,8)]
|
|
[SerializeField] int _maxLightCount = 3;
|
|
private int _lightCountBefore = 1;
|
|
|
|
private void Awake()
|
|
{
|
|
UniversalRenderPipelineAsset urpAsset = UniversalRenderPipeline.asset;
|
|
if (urpAsset != null)
|
|
{
|
|
_lightCountBefore = urpAsset.maxAdditionalLightsCount;
|
|
urpAsset.maxAdditionalLightsCount = _maxLightCount;
|
|
}
|
|
}
|
|
|
|
private void OnDestroy()
|
|
{
|
|
UniversalRenderPipelineAsset urpAsset = UniversalRenderPipeline.asset;
|
|
if (urpAsset != null)
|
|
{
|
|
urpAsset.maxAdditionalLightsCount = _lightCountBefore;
|
|
}
|
|
}
|
|
}
|
|
}
|