playMaker

Author Topic: Set Light Culling Mask  (Read 1980 times)

nick_h82

  • Playmaker Newbie
  • *
  • Posts: 36
    • View Profile
Set Light Culling Mask
« on: September 28, 2015, 01:30:04 AM »
As per the title, I need to set the culling mask of a light. I tried copying what the camera culling mask action did, as that works in the way I'd like, but got an error:

Assets/PlayMaker Custom Actions/SetLightCullingMask.cs(52,22): error CS0120: An object reference is required to access non-static member `UnityEngine.Light.cullingMask'

I've attached my attempt below. Really need to learn some rudimentary C# sometime..

nick_h82

  • Playmaker Newbie
  • *
  • Posts: 36
    • View Profile
Re: Set Light Culling Mask
« Reply #1 on: September 30, 2015, 10:48:13 PM »
I should add I looked at the wiki for writing actions, the ActionHelpers class page is TODO since 2011..

dudebxl

  • Hero Member
  • *****
  • Posts: 602
    • View Profile
Re: Set Light Culling Mask
« Reply #2 on: October 01, 2015, 04:13:52 AM »
Hi,

Have u tried ' set sorting renderer layer ' ?

U can get from ecosystem... If it does not work, then let me know and i make it for u..

« Last Edit: October 01, 2015, 04:16:46 AM by dudebxl »

nick_h82

  • Playmaker Newbie
  • *
  • Posts: 36
    • View Profile
Re: Set Light Culling Mask
« Reply #3 on: October 01, 2015, 07:08:32 PM »
Hi Dudebxl,

Thanks for the suggestion. I tried that but it wasn't quite what I was after. Effectively I was trying for an action that works exactly like SetCameraCullingMask does, in terms of setting layers, just on the light rather than the camera. I'd be very grateful for any help, even if it's just advice on where I'm going wrong with the earlier script.

dudebxl

  • Hero Member
  • *****
  • Posts: 602
    • View Profile
Re: Set Light Culling Mask
« Reply #4 on: October 02, 2015, 01:15:46 AM »
done.

on ecosystem or here: https://snipt.net/dudebxl/setlightcullingmask/

not sure what you did wrong but i took the camera culling script and modified it in 1 min. Check ur script vs my script to find ur mistake.

good luck  ;D

nick_h82

  • Playmaker Newbie
  • *
  • Posts: 36
    • View Profile
Re: Set Light Culling Mask
« Reply #5 on: October 03, 2015, 01:40:18 AM »
Hi, yup, incorrect capitalisation on my part, otherwise we had the same solution. Thanks for helping out!