playMaker

Author Topic: Off Hierarchy prefabs dont communicate to hierarchy game objects or prefabs.  (Read 2564 times)

fromfame

  • Junior Playmaker
  • **
  • Posts: 78
  • Sloppy PM Veteran
I thought it was something i misunderstood, although i confirmed it once i continuously tried adding actions "send event" or "Activate GO" to a prefab off the hierarchy and once it spawns in game it can't communicate with other GOs!

What i have:
Once the player presses "1" you spawn a gem from the project folder and its power will not be active unless the player presses the LMB. I've got actions everywhere off the prefab telling it to activate on click yet it rebels against me and only works when its all in prefab.

i created a Game object prefab that isn't on the hierarchy that was supposed to activate a game object that is on the hierarchy and they just dont communicate.
please help im not going anywhere with my project!

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Hi,

 you need to manually bind and reference prefabs together, it's a common problem.


You do that, either by "searching" for them using the "findgameObject" action, but I don't recommand it.

you can also fire global events, when a prefab is instanciated for anyone interested to store its reference. for example "GEM INSTANCIATED" would be a global custom event, and any object will to keep track of gems would implement that event as a global event in their fsm and store the gameobject who sent that event, knowing it will be a gem.

 then you can do all sorts of filterning, by tag, by name, or even access fsm in that sender, if you expect a certain standard. For example if all your gems MUST have an fsm called "Gem Interface", with some variable in there, you can safely access it blindly using "Get Fsm xxx" because only gem can send that event "GEM INSTANCIATED".

Does that make sense?

bye,

 Jean