Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: Gatsu on November 05, 2017, 02:37:18 PM

Title: How to simply get a variable from a component? [SOLVED]
Post by: Gatsu on November 05, 2017, 02:37:18 PM
Hi, I have spent last couple hours trying to read a variable of a GameObjects component but in playmaker. I have a GameObject with a "ScoreCounter" component attached which is a MonoBehaviour extended class. I can find this GameObject by its tag but I am unable to get it's component called "ScoreCounter". This component contains a variable named "killCount" which I want to use with playmakers "Int Compare".

Below you see I am using Get Component but it's not allowing me to pick a component that is on the GameObject stored in "score". There is no input field which lets me pick a component. This is very confusing to me, how does this work? Is this a bug?

(https://dl.dropboxusercontent.com/s/gn3wlbkcvds8uyi/scorecounter.PNG)
Title: Re: How to simply get a variable from a component?
Post by: Gatsu on November 05, 2017, 03:11:39 PM
and I figure it out after typing, I have to create a special type of variable that is of type "ScoreCounter" which then can provide the "killCount" variable that I am looking for. Thank you.
Title: Re: How to simply get a variable from a component? [SOLVED]
Post by: djaydino on November 05, 2017, 04:22:36 PM
Hi,
Thanks for answering your own question, it can always be useful for someone else.  ;)