admin 管理员组

文章数量: 887021

unity:

public class createlight : MonoBehaviour {public GameObject clight;//创建一个游戏物体变量,存放物体public Light jglight;public GameObject qiu;// Use this for initializationvoid Start () {//这个方法 new GameObject();  可以创建一个新物体clight=new GameObject("clight01");clight.transform.position = new Vector3 (0,5f,0);//给灯定义一个方向jglight=clight.AddComponent<Light> ();  //添加灯组件jglight.type = LightType.Spot;jglight.intensity = 10f;jglight.color = Color.yellow;}// Update is called once per framevoid Update () {if (Input.GetKeyDown ("space")) {new GameObject("clight02");}jglight.transform.LookAt (qiu.transform.position);}
}

本文标签: unity