Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: Horror on October 23, 2012, 08:11:07 AM

Title: Change Light Render Mode
Post by: Horror on October 23, 2012, 08:11:07 AM
Is it possible to change the Render Mode of a light at runtime? I started working on some quality settings for my game and then realised that there was no property listed for Render Mode in Set Property.

I need to do this because I require a movable dynamic light and the iPhone 4 just can't handle per-pixel lighting. I still want to give more powerful phones the option to use a per-pixel light, though.

If this isn't possible then I will just have to create two versions of each light and toggle them... but being able to simply change the property would be far more elegant.

Thanks :)
Title: Re: Change Light Render Mode
Post by: kiriri on October 23, 2012, 02:10:13 PM
for what it's worth, it should be possible:
http://docs.unity3d.com/Documentation/ScriptReference/Light-renderMode.html
However, there is no such object as a LightRenderMode within Playmaker, because it's an enumerate. So I suppose it's out of the question for playmaker for now. A normal script should do it though :D
Title: Re: Change Light Render Mode
Post by: Horror on October 23, 2012, 07:06:35 PM
Thanks Kiriri,

I created two scripts:

Low Quality
Code: [Select]
function Start () {
// Make the light render with vertex lighting
light.renderMode = LightRenderMode.ForceVertex;
}

High Quality
Code: [Select]
function Start () {
// Make the light render with pixel lighting
light.renderMode = LightRenderMode.ForcePixel;
}

Then I just fire the script I want with the Add Script action. It's simple enough that I won't have to pester Jean for a custom action ;)
Title: Re: Change Light Render Mode
Post by: jeanfabre on October 24, 2012, 04:01:30 AM
Hi,

 Yes, enums are unfortuntatly not supported within playmaker, so it's always a case of either use a string representation of the enum and make a case statement within the custom action to turn it back into an proper enum option.

bye,

 Jean