playMaker

Author Topic: Trouble dragging GameObjects onto an Action  (Read 1291 times)

LAB618

  • Playmaker Newbie
  • *
  • Posts: 23
    • View Profile
Trouble dragging GameObjects onto an Action
« on: February 15, 2017, 05:05:14 PM »
Hello,

I have a Send Event action set up that I want to send an event to an FSM on another GameObject but when I try and drag that GameObject into the appropriate slot it won't set it.

Is anyone else having this problem? Could it be something to do with using dual monitors? I'm using the latest versions of both Unity and Playmaker.

Can anyone help please?

LAB618

  • Playmaker Newbie
  • *
  • Posts: 23
    • View Profile
Re: Trouble dragging GameObjects onto an Action
« Reply #1 on: February 15, 2017, 05:13:42 PM »
If I use the target picker next to the required field, it only lists prefabs and nothing else.

marv

  • Junior Playmaker
  • **
  • Posts: 50
    • View Profile
Re: Trouble dragging GameObjects onto an Action
« Reply #2 on: February 16, 2017, 05:38:47 AM »
You can not directly reference Objects in the scene inside a prefab. You need to either

- Store the object used in a global variable
- Pass the object to the prefab on creation in runtime
or
- Get the object via a "find object" action (it's recommended to search by tag, not by name... those actions are resource intensive)

Personally, I used a mix of the first two.

cheers

LAB618

  • Playmaker Newbie
  • *
  • Posts: 23
    • View Profile
Re: Trouble dragging GameObjects onto an Action
« Reply #3 on: February 16, 2017, 03:00:30 PM »
Thanks Marv, I thought it might have had something to do with the state being on a prefab.

I did find a workaround but not sure it's a good way to work. I created an FSM on a new empty GameObject, added the required action and set it up as I needed, and then copied from there onto the state in the Prefab. When I copied it it remembered all the settings. I didn't have time last night but I'm going to check it tonight and make sure it's not causing any problems.

Cheers.

LAB618

  • Playmaker Newbie
  • *
  • Posts: 23
    • View Profile
Re: Trouble dragging GameObjects onto an Action
« Reply #4 on: February 16, 2017, 04:27:33 PM »
Well it turns out that what I described above is a bad way to work. It sort of worked when I did it but the settings didn't persist when I next launched Unity. I stored the object in a Global Variable and it works as expected.