playMaker

Author Topic: Getting light component from a game object[SOLVED]  (Read 2985 times)

Arnoob

  • Junior Playmaker
  • **
  • Posts: 63
Getting light component from a game object[SOLVED]
« on: March 05, 2017, 11:35:56 AM »
Hello every one.

In order to make some assets work correctly, I need to show to a script what directional light it needs to use. Using the "set property" node, I can set the light component. However, I don't know how to GET the "light" component from a game object.

Also, I tried the "get component" nodes, but I can't understand how it works, are they bugged?

So TLDR: how can I get a light component in playmaker?

I'm sure the answer is silly easy, but I can't find it so far :-/
« Last Edit: March 06, 2017, 08:24:25 AM by jeanfabre »

mdotstrange

  • Hero Member
  • *****
  • Posts: 555
    • Can't code? Who cares! Make games anyway!
Re: Getting light component from a game object
« Reply #1 on: March 05, 2017, 12:01:33 PM »
Use the "get property" action
Indie game dev and instructor at the Strange School. Learn Playmaker at the Strange School!

Arnoob

  • Junior Playmaker
  • **
  • Posts: 63
Re: Getting light component from a game object
« Reply #2 on: March 05, 2017, 12:13:13 PM »
My bad, I should've mentioned that I already tried the get property also.
I can access all the values (intensity, color, flare etc...) but I can't get the light object itself into a variable.

mdotstrange

  • Hero Member
  • *****
  • Posts: 555
    • Can't code? Who cares! Make games anyway!
Re: Getting light component from a game object
« Reply #3 on: March 05, 2017, 12:57:22 PM »
Oh ok- if you want to save a variable type that PM does not support use the Object variable type- you have to set the variable type after creating the variable by usually choosing UnityEngine--> then the object type
Indie game dev and instructor at the Strange School. Learn Playmaker at the Strange School!

Arnoob

  • Junior Playmaker
  • **
  • Posts: 63
Re: Getting light component from a game object
« Reply #4 on: March 05, 2017, 01:22:55 PM »
Oh, do you mean that the only way is to create custom action? (I'm sorry I didn't exactly understood your answer, it's not my first language)

mdotstrange

  • Hero Member
  • *****
  • Posts: 555
    • Can't code? Who cares! Make games anyway!
Re: Getting light component from a game object
« Reply #5 on: March 05, 2017, 01:52:44 PM »
You can create an object variable


Set the type to light


Then you can use the variable


A custom action would be best- but you can get it with get component
Indie game dev and instructor at the Strange School. Learn Playmaker at the Strange School!

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Getting light component from a game object
« Reply #6 on: March 06, 2017, 12:41:05 AM »
Hi,

 I doubt that will help you telling a script the light component, what is the api on that script? is it a method, a property?

 Bye,

 Jean

Arnoob

  • Junior Playmaker
  • **
  • Posts: 63
Re: Getting light component from a game object
« Reply #7 on: March 06, 2017, 05:08:44 AM »
Wow mdostrange! I can't thank you enough

It's been 2 years that I started using PM, and I can't believe I didn't knew that.
Now I am able to get any component in my scenes, including a lot of custom assets that I didn't knew was possible.

@Jeanfabre : Hey how are you? It's been a while. Well mdostrange's method totally worked, I simply had to create the light object variable, use the "get component" action to store it, and put it on the post effect component using the "set property" action!

The great new is that now I will be able to do a lot of things with purchased assets I didn't knew was possible! I get back to work, I've got to see what I can get out of Aaron grandberg's pathinding knowing that method now ;-D

Cheers!

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Getting light component from a game object
« Reply #8 on: March 06, 2017, 08:24:12 AM »
Hi,

 Great :)

 Bye,

Jean