2024. 5. 12. 12:01
Unity/C#


유니티 2022.3.22.f1 이후의 경우

유니티 2022.3.22.f1 이전의 경우는 아래 스크립트 적용
SettingLightResolution.unitypackage
0.00MB
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
[ExecuteAlways]
public class SettingLightResolution : MonoBehaviour
{
public Light light;
public int resolution = 256;
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
if (light==null)
{
return;
}
light.shadowCustomResolution = resolution;
#if UNITY_EDITOR
UnityEditor.EditorUtility.SetDirty(light);
#endif
}
}
어쩌다보니 만들게 됨
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Collections; | |
using System.Collections.Generic; | |
using UnityEngine; | |
[ExecuteAlways] | |
public class SettingLightResolution : MonoBehaviour | |
{ | |
public Light light; | |
public int resolution = 256; | |
// Start is called before the first frame update | |
void Start() | |
{ | |
} | |
// Update is called once per frame | |
void Update() | |
{ | |
if (light==null) | |
{ | |
return; | |
} | |
light.shadowCustomResolution = resolution; | |
#if UNITY_EDITOR | |
UnityEditor.EditorUtility.SetDirty(light); | |
#endif | |
} | |
} |
'Unity > C#' 카테고리의 다른 글
OnSceneGUI 관련코드 (0) | 2024.07.11 |
---|---|
유니티 프리팹 드래그 드랍 (0) | 2024.05.09 |
AutomaticShadowDistance (0) | 2024.04.18 |