hi gang, so i desided to give this a go, however distance.vector3 dose not exist.
trying to make lights decreese in intencity with distancething in the from player camera.
the players are instantiated in the scene as well as lights so i canot use inspector
to assaign objects…
using UnityEngine;
using System.Collections;
public class LightingDistance : MonoBehaviour {
// put this on the users camera on the userfighter01...........
// LIGHT CONTROLL...........
// cannot use inspector, to manualy assaign lights or game objects must be done within code......
//must find and use all pointlights even those that have been instantiated....
//__________________________________________________________________________________________________________________
public Transform light;
public GameObject Lights;
//__________________________________________________________________________________________________________________
// Find all lights in the scene and decreece by distance..........
//__________________________________________________________________________________________________________________
//__________________________________________________________________________________________________________________
void Update () {
Lights = FindObjectsOfType(typeof(Light)) as Light[]; //get all lights in the scene and set as Lights.
//need a away to only effect pointlights......
float dist = Vector3.Distance(Lights.position, transform.position); // get all distance of lights
// now we should have all lights and their distance from this game object..........
Lights.intensity = 1 * Distance; // increese and decreeese light intensaty with distance.....
} // end of update...........
//__________________________________________________________________________________________________________________