2026-10-22 12:41:09 +01:00
|
|
|
using UnityEngine;
|
|
|
|
|
using UnityEngine.Rendering.Universal;
|
|
|
|
|
|
|
|
|
|
namespace UFMTESTING1
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Use this component to set some unity settings for your world
|
|
|
|
|
/// </summary>
|
|
|
|
|
public class UnitySettings : MonoBehaviour
|
|
|
|
|
{
|
2026-10-26 18:17:30 +00:00
|
|
|
[Range(1, 8)]
|
2026-10-22 12:41:09 +01:00
|
|
|
[SerializeField] int _maxLightCount = 3;
|
2026-10-26 18:17:30 +00:00
|
|
|
[Range(0.05f, 1.0f)]
|
|
|
|
|
[SerializeField] float _lodCrossFadeDuration = 0.1f;
|
|
|
|
|
|
2026-10-22 12:41:09 +01:00
|
|
|
private int _lightCountBefore = 1;
|
2026-10-26 18:17:30 +00:00
|
|
|
private float _locCrossFadeDurationBefore = 0.1f;
|
2026-10-22 12:41:09 +01:00
|
|
|
|
|
|
|
|
private void Awake()
|
2026-10-26 18:17:30 +00:00
|
|
|
{
|
|
|
|
|
Apply();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[ContextMenu("- Editor Aplly")]
|
|
|
|
|
private void Apply()
|
2026-10-22 12:41:09 +01:00
|
|
|
{
|
|
|
|
|
UniversalRenderPipelineAsset urpAsset = UniversalRenderPipeline.asset;
|
|
|
|
|
if (urpAsset != null)
|
|
|
|
|
{
|
|
|
|
|
_lightCountBefore = urpAsset.maxAdditionalLightsCount;
|
|
|
|
|
urpAsset.maxAdditionalLightsCount = _maxLightCount;
|
|
|
|
|
}
|
2026-10-26 18:17:30 +00:00
|
|
|
|
|
|
|
|
Debug.Log(" AA " + LODGroup.crossFadeAnimationDuration);
|
|
|
|
|
|
|
|
|
|
// Cross fade
|
|
|
|
|
if (_lodCrossFadeDuration > 0.0f)
|
|
|
|
|
{
|
|
|
|
|
_locCrossFadeDurationBefore = LODGroup.crossFadeAnimationDuration;
|
|
|
|
|
LODGroup.crossFadeAnimationDuration = _lodCrossFadeDuration;
|
|
|
|
|
}
|
2026-10-22 12:41:09 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void OnDestroy()
|
|
|
|
|
{
|
|
|
|
|
UniversalRenderPipelineAsset urpAsset = UniversalRenderPipeline.asset;
|
|
|
|
|
if (urpAsset != null)
|
|
|
|
|
{
|
|
|
|
|
urpAsset.maxAdditionalLightsCount = _lightCountBefore;
|
|
|
|
|
}
|
2026-10-26 18:17:30 +00:00
|
|
|
|
|
|
|
|
if (_locCrossFadeDurationBefore > 0.0f)
|
|
|
|
|
{
|
|
|
|
|
LODGroup.crossFadeAnimationDuration = _locCrossFadeDurationBefore;
|
|
|
|
|
}
|
2026-10-22 12:41:09 +01:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|