playMaker

Author Topic: Import variables from custom scripts  (Read 390 times)

schinken

  • Playmaker Newbie
  • *
  • Posts: 1
    • View Profile
Import variables from custom scripts
« on: May 01, 2017, 10:28:42 AM »
Heho.

I just downloaded Playmaker with minor coding knowledge (did a lot of game stuff already, but more on the art side :) ), and I have one problem.
Whenever I search for the solution I just get very very confusing answers.

So, I guess the solution is already out there, but some of you guys need to break it down to someone like me :). Sorry



I don't really see a way to use variables from my scripts in playmaker.

SO. I have a variable a and want to initiate a transition when it is at a certian value or true or whatever.
I already tried to play around with the GetProperty thing, but it doesn't really work.
Or I have a variable a and want to change it to a different value.

How do I do that?

Shawn Kilian

  • Playmaker Newbie
  • *
  • Posts: 49
  • Multimedia Designer
    • View Profile
Re: Import variables from custom scripts
« Reply #1 on: May 01, 2017, 11:18:50 AM »
The way I play with variables from scripts is to drag the script from my GameObject into PlayMaker and 3 options appear: Get Property, Set Property and Method.  Use the Method option and select the variable you are trying to manipulate.

tcmeric

  • Hero Member
  • *****
  • Posts: 651
    • View Profile
Re: Import variables from custom scripts
« Reply #2 on: May 01, 2017, 07:55:52 PM »
You need to write a custom action. You can learn how to do so here: https://www.youtube.com/watch?v=U0zm2EVqDBU

Its not too hard if you are already familiar with C# especially and only looking to pass variables back and forth.

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 13323
  • Official Playmaker Support
    • View Profile
Re: Import variables from custom scripts
« Reply #3 on: May 02, 2017, 10:30:58 PM »
Hi,

 A Custom Action is the way to go, but GetProperty and SetProperty should work, for all public variables in regular components, if your script is not a component then yes, a custom action is mandatory.

 Bye,

 Jean