playMaker

Author Topic: (Solved) Playmaker identifying hierarchy object but not asset folder prefab  (Read 1786 times)

heavygunner

  • Sr. Member
  • ****
  • Posts: 344
Hi !

I created a cube and dragged it to asset folder.
Then I created an FMS on another empty object to detect collision with player tag.

It worked when I dragged & dropped the object from hierarchy . But, not detecting when i dragged and dropped same object from asset folder.



What is the issue ?
I checked everything.

Thanks
« Last Edit: October 14, 2018, 08:33:03 AM by heavygunner »

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7616
    • jinxtergames
Re: Playmaker identifying hierarchy object but not asset folder prefab
« Reply #1 on: October 13, 2018, 03:04:22 PM »
Hi.
A prefab that is in the project folder can't communicate directly with scene objects.

When a prefab is placed from the project to a scene it is not 'that' object but a clone from that object.

the trigger would look for 'that' object,
which is still in the Project window and will never be in the game itself (hierarchy)

Even the one that you used to create the prefab, is not the same object.

i hope you understand what i mean :)

Thore

  • Sr. Member
  • ****
  • Posts: 480
Re: Playmaker identifying hierarchy object but not asset folder prefab
« Reply #2 on: October 13, 2018, 04:18:07 PM »
The game object in the asset folder is called a “prefab”. Once you put a prefab into the scene, it creates an instance of the prefab. When you do this on runtime (when the game is playing), it also calls them “<name> (clone)”. As Djaydino says, they aren’t the same thing. The prefab is a “blueprint” of sorts.

Normally, you only drag drop scene game objects into scripts (or actions), (a) when the game objects are child of the FSM/holder or (b) when the game object is a manager or other “default” game object, i.e. things you know are always in the scene, when called. You use prefabs in actions typically to create instances, spawn enemies, bullets, etc.

heavygunner

  • Sr. Member
  • ****
  • Posts: 344
Finally got it.
Instead of writing fsm for objects on another gamemanager, i wrote fsm on object owner. no, issues so far.

looks like i have tons of things to learn in Unity :D