各位,我有点小问题。我需要从脚本中访问2D灯光强度。我试着用GetComponent<>这样做,但不起作用。也许,我对GetComponent<>做错了什么,因为我是初学者。Screenshot of what I want to control
发布于 2021-05-12 04:42:14
你可以调用GetComponent<>(),但是你可能做错了。
using UnityEngine;
using UnityEngine.Experimental.Rendering.Universal;
public class ControllingIntensity : MonoBehaviour
{
public float intensity;
void Start()
{
GetComponent<Light2D>().intensity = intensity;
}
}https://stackoverflow.com/questions/67493746
复制相似问题