playMaker

Author Topic: Use Runtime GameObject in MoveTowards  (Read 2425 times)

kd5crs

  • Playmaker Newbie
  • *
  • Posts: 2
Use Runtime GameObject in MoveTowards
« on: April 29, 2013, 11:09:56 PM »
I have a script that instantiates a prefab in Start(). I want to be able to set that instantiated object as the target in Playmaker, specifically in the MoveTowards action. I can't figure out how, because it doesn't exist in the scene yet before clicking Play. I tried to set it as a variable, I tried to make it a static var in the script, I tried to get the script component... I'm out of ideas.

Thanks.

Pawel

  • Junior Playmaker
  • **
  • Posts: 93
Re: Use Runtime GameObject in MoveTowards
« Reply #1 on: April 30, 2013, 03:36:10 PM »
Why don't you just have the prefab in the scene? You can position it so won't be seen by the camera... Then your script will have something to instantiate.

kd5crs

  • Playmaker Newbie
  • *
  • Posts: 2
Re: Use Runtime GameObject in MoveTowards
« Reply #2 on: May 01, 2013, 04:46:03 PM »
Sure, but is there really no other way?

Alex Chouls

  • Administrator
  • Hero Member
  • *****
  • Posts: 4002
  • Official Playmaker Support
    • LinkedIn
Re: Use Runtime GameObject in MoveTowards
« Reply #3 on: May 01, 2013, 05:27:09 PM »
Generally you would use Find Game Object using the name or tag. Store that in a GameObject variable and use it in MoveTowards.

Phillament

  • Playmaker Newbie
  • *
  • Posts: 44
Re: Use Runtime GameObject in MoveTowards
« Reply #4 on: December 13, 2013, 01:45:24 AM »
Oh wow, this just solved a problem I've been working on for hours! Thanks Alex!