playMaker

Author Topic: Gameobject variable via inspector with Prefab  (Read 1630 times)

Grofit

  • Junior Playmaker
  • **
  • Posts: 73
Gameobject variable via inspector with Prefab
« on: April 02, 2014, 04:39:55 AM »
I have a prefab called Enemy (just a simple entity who follows a target), now in the playmaker script I have a variable for the target (exposed via inspector).

Now my first query was that the prefab enemy can only take other prefabs as arguments for this "target" inspector variable. So how can I get it to follow a specific instance of a given prefab in the scene?

The second part of it is I have told it to target a "Player" prefab (there is only 1 of them in the scene), however when I check the distance between them, it always lists the same distance between them regardless of where I move the player instance, and it is updating every frame... so is this because its not looking at my instance of the player and is looking elsewhere?

Hopefully the 2 points above show the problem I am having, so any advice would be great!

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Gameobject variable via inspector with Prefab
« Reply #1 on: April 03, 2014, 08:10:01 AM »
Hi,

 you need to implement a mechanism for the prefab instance to go get the targt itself, or actually wait for an event to send it to itself.

 So, at the point where you instantiate your new enemy, save the instance you created, and either use "Set fsm xxx" to populate some of its values, or send it an event.

Bye,

 Jean