playMaker

Author Topic: Problem with Send Event  (Read 3819 times)

dharry

  • Playmaker Newbie
  • *
  • Posts: 11
Problem with Send Event
« on: July 03, 2015, 06:28:51 AM »
Hi All,

I'm having a problem with the Send Event action, when I go to select a game object using the selection box it only shows me assets and not game objects. I have watched a few tutorials and they all seem to be able to pick game objects.

I have set the Send Event up with Event Target: Game Object FSM and GameObject as Specify Game Object.

If I try and drag one into the field it won't let me... can anyone tell me what i'm doing wrong?

If I make the game object a prefab it will let me select it and all appears to be ok except that my trigger doesn't trigger...

That being said, I am using a Trigger Enter 2D event and not the standard Trigger Enter event but I can't see how that would make a difference.

I am on the latest PM and Unity...

Thanks
Dean

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7616
    • jinxtergames
Re: Problem with Send Event
« Reply #1 on: July 03, 2015, 08:16:40 AM »
Hi,
is you send event action in a prefab?

dharry

  • Playmaker Newbie
  • *
  • Posts: 11
Re: Problem with Send Event
« Reply #2 on: July 03, 2015, 08:41:15 AM »
Hi Dino,

Yes, it is, does that make a difference?

Dean

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7616
    • jinxtergames
Re: Problem with Send Event
« Reply #3 on: July 03, 2015, 09:16:01 AM »
yes you can't do that,

Here you can find some important info

Quote
In Unity:

- A scene object can reference other scene objects & prefabs

- A prefab can only references other prefabs and can not reference scene objects (even though it looks like it can, that reference will be lost on save/load)

In general this means you should use Find Game Object, e.g., in the start state so you only do it once, then use that as the target in Send Event To FSM. Or if an event is more widely interesting you could use Broadcast Event.

dharry

  • Playmaker Newbie
  • *
  • Posts: 11
Re: Problem with Send Event
« Reply #4 on: July 03, 2015, 08:04:19 PM »
Thanks Dino,

Makes sense but I still can't seem to get it to work.

In the Start state I have added a Find Game Object and store that in a variable of type Game Object, then in the Send Event I select that variable as the game object but it just doesn't seem to do what I want it to.

All I am trying to do is make a simple scoring system. The reason it is a prefab is because I have 300 of the same item on the screen.

I just don't understand where I am going wrong...

Regards,
Dean

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7616
    • jinxtergames
Re: Problem with Send Event
« Reply #5 on: July 04, 2015, 06:00:44 AM »
Hi,

and all 300 are using send event?

i need a little bit more info to help you

dharry

  • Playmaker Newbie
  • *
  • Posts: 11
Re: Problem with Send Event
« Reply #6 on: July 04, 2015, 07:06:31 AM »
Thanks Dino,

I have been messing around with this a fair bit and I think the bigger problem is that my Trigger Enter 2D doesn't seem to be firing. I think the Send Event would work fine, I just can't seem to get the trigger to run...

I have a box collider 2d on my prefab and ticked Is Trigger then on my player I have a RigidBody 2D and a Circle Collider 2D but they just dont seem to be triggering the event.

Any ideas? or anything more I can tell you that might help point me in the right direction?

Cheers
Dean