playMaker

Author Topic: [SOLVED] Action on a Prefab not working as expected  (Read 2261 times)

m1

  • Playmaker Newbie
  • *
  • Posts: 11
[SOLVED] Action on a Prefab not working as expected
« on: April 26, 2012, 01:39:07 PM »
I have looked through many of the discussion threads about prefab issues, but I'm not sure that my issue has been addressed.  Perhaps I just missed a something in the instructions.

My issue is that when I am applying an action to a prefab, such as 'Get Distance', I can not select a target object from my hierarchy to be applied.  The action won't let me.  When I apply 'Get Distance' to an object in the hierarchy directly, then select another object to use as the target it works just fine.  

Is this a bug, or something that is just not capable of happening?

Thanks!
Brian
« Last Edit: April 29, 2012, 07:31:39 PM by Alex Chouls »

Alex Chouls

  • Administrator
  • Hero Member
  • *****
  • Posts: 4000
  • Official Playmaker Support
    • LinkedIn
Re: Action on a Prefab not working as expected
« Reply #1 on: April 26, 2012, 07:40:44 PM »
In Unity, prefabs cannot reference scene objects, only other prefabs/assets.

So you need to find the target object at runtime and store it in a variable.

Does that make sense? This is a common confusion with prefabs...

m1

  • Playmaker Newbie
  • *
  • Posts: 11
Re: Action on a Prefab not working as expected
« Reply #2 on: April 29, 2012, 05:11:51 PM »
OK thanks for the info Alex.  I guess I misunderstood how to use Prefabs properly.