|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Light Inherits from Behaviour
Script interface for light components. Use this to control all aspects of Unity's lights. The properties are an exact match for the values shown in the Inspector. Usually lights are just created in the editor but sometimes you want to create a light from a script:
JavaScripts
function Start () {
// Make a game object var lightGameObject : GameObject = new GameObject("The Light"); // Add the light component lightGameObject.AddComponent(Light); // Set color and position lightGameObject.light.color = Color.blue; // Set the position (or any transform property) after // adding the light component. lightGameObject.transform.position = Vector3(0, 5, 0); }
using UnityEngine;
using System.Collections; public class example : MonoBehaviour { void Start() { GameObject lightGameObject = new GameObject("The Light"); lightGameObject.AddComponent<Light>(); lightGameObject.light.color = Color.blue; lightGameObject.transform.position = new Vector3(0, 5, 0); } }
import UnityEngine
import System.Collections class example(MonoBehaviour): def Start(): lightGameObject as GameObject = GameObject('The Light') lightGameObject.AddComponent[of Light]() lightGameObject.light.color = Color.blue lightGameObject.transform.position = Vector3(0, 5, 0)
Variables
Inherited members
Inherited Variables
Inherited Functions
Inherited Class Functions
|
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||