playMaker

Author Topic: Change Light Render Mode  (Read 3346 times)

Horror

  • Junior Playmaker
  • **
  • Posts: 79
Change Light Render Mode
« 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 :)

kiriri

  • Hero Member
  • *****
  • Posts: 506
Re: Change Light Render Mode
« Reply #1 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
Best,
Sven

Horror

  • Junior Playmaker
  • **
  • Posts: 79
Re: Change Light Render Mode
« Reply #2 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 ;)

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Change Light Render Mode
« Reply #3 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