- Home /
Question by
laurienash · May 09, 2015 at 10:04 PM ·
colorglobal illuminationemissivelinear
Translating DynamicGI.SetEmissive script from C# to javascript not working
Hi - I'm struggling to work out how to translate this script from C# to javascript, as I want to insert it into a script I've already written in javascript.
It's to turn on the emission of an object on pressing a key down.
But the update function is throwing up lots of errors and I'm struggling to find an example in javascript.
#pragma strict
var lightwall : Renderer;
var worldprobe : Transform;
function Start () {
var lighton : boolean = false;
}
function Update () {
if (Input.GetKeyDown(KeyCode.T))
{
lighton = !lighton;
}
if (lighton)
{
Color final = Color.grey * Mathf.LinearToGammaSpace(5);
lightwall.material.SetColor("_EmissionColor", final);
DynamicGI.SetEmissive(lightwall, final);
}
else
{
Color final = Color.grey * Mathf.LinearToGammaSpace(0);
lightwall.material.SetColor("_EmissionColor", final);
DynamicGI.SetEmissive(lightwall, final);
}
}
}
Could anyone point me in the right direction as to how I can alter these lines to work in javascript?
Color final = Color.grey * Mathf.LinearToGammaSpace(5);
lightwall.material.SetColor("_EmissionColor", final);
DynamicGI.SetEmissive(lightwall, final);
Best, Laurien
Comment