Question by
peiust21 · Dec 06, 2018 at 08:38 PM ·
scripting problemlightingemission
I need some help !
So i want when the player get in contact with the pressure plate the material to change to activate emission . Here is how i made the pressure plate using System.Collections; using System.Collections.Generic; using UnityEngine;
public class pressure_plate : MonoBehaviour { private Light myLight;
void Start()
{
myLight.GetComponent<Light>();
}
void OnTriggerEnter (Collider col)
{
GameObject lightGameObject = new GameObject("The Light");
Light lightComp = lightGameObject.AddComponent<Light>();
lightComp.color = Color.red;
lightGameObject.transform.position = gameObject.transform.position;
lightComp.intensity = 20;
lightComp.range = 20;
}
}
Comment