playMaker

Author Topic: How to change variables at runtime [SOLVED]  (Read 2612 times)

tim.holman

  • 1.2 Beta
  • Playmaker Newbie
  • *
  • Posts: 49
How to change variables at runtime [SOLVED]
« on: September 07, 2011, 05:42:44 PM »
I've been working on some camera functionality using Playmaker and I would like to know if there's a way to access variables strored in other scripts. For example, I'm using the "Smooth Follow" script and I need to change the target variable at run time (from "Player" to "Golf Ball"). Is there a way to change the target at runtime or do I need to set up another camera?
« Last Edit: October 05, 2011, 02:03:17 PM by alexchouls »

Alex Chouls

  • Administrator
  • Hero Member
  • *****
  • Posts: 3987
  • Official Playmaker Support
    • LinkedIn
Re: How to change variables at runtime
« Reply #1 on: September 07, 2011, 05:54:50 PM »
You can use the Set Property action in 1.2.

Drag the SmoothFollow component into the object field (you may need to lock the graph view if it's on another gameobject). Then select the property you want to set.

Get and Set Property are very powerful new actions for interacting with any Unity object (e.g., components, textures, materials...)

tim.holman

  • 1.2 Beta
  • Playmaker Newbie
  • *
  • Posts: 49
Re: How to change variables at runtime
« Reply #2 on: September 08, 2011, 10:42:52 AM »
Thanks!
« Last Edit: September 08, 2011, 11:43:05 AM by tim.holman »