Version: 2022.1
언어: 한국어
public float spotAngle ;

설명

The angle of the light's spotlight cone in degrees.

This is used primarily for Spot lights and has no effect for Point lights See Also: Light component.

using UnityEngine;

public class Example : MonoBehaviour { // Change spot angle randomly between 'minAngle' and 'maxAngle' // each 'interval' seconds.

float interval = 0.3f; float minAngle = 10; float maxAngle = 90; float timeLeft;

Light lt;

void Start() { lt = GetComponent<Light>(); lt.type = LightType.Spot;

timeLeft = interval; }

void Update() { timeLeft -= Time.deltaTime;

if (timeLeft < 0.0) { // time to change! timeLeft = interval; lt.spotAngle = Random.Range(minAngle, maxAngle); } } }
Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961