playMaker

Author Topic: Send event to a Prefab  (Read 1910 times)

Rabagast

  • Hero Member
  • *****
  • Posts: 683
    • Homepage
Send event to a Prefab
« on: October 04, 2014, 04:18:51 PM »
Hi!

I have two questions:

1. Why is it not possible to send an event to a Prefab?

2. I have a power up which is moving down to my space ship which is on the ground. I use "Trigger Enter" on the power up. But the space ship will not pick it up , since the power up is trigger. So the space ship doesn't enter the trigger if I don't move. If I move the space ship when I enter the trigger, I will pick it up. I can use "Trigger Enter" on the space ship, but it will be better to use it on all the power ups, since they give different powers.
What is the best way to to this?

Hope somebody can help me with this. :)
Check out our homepage. http://www.walsberg.no
Or my personal game blog for news about my games. http://retro-tetro.walsberg.no

jess84

  • Hero Member
  • *****
  • Posts: 515
Re: Send event to a Prefab
« Reply #1 on: October 04, 2014, 04:42:38 PM »
1) Store your gameobject as a gameobject global variable after it has spawned - then reference that gameobject variable to access it.

2) Do you have the correct components on both of your objects? It's been discussed many times about rigidbodies, colliders etc.
« Last Edit: October 04, 2014, 04:45:22 PM by jess84 »

Rabagast

  • Hero Member
  • *****
  • Posts: 683
    • Homepage
Re: Send event to a Prefab
« Reply #2 on: October 04, 2014, 08:35:30 PM »
Hi!

Every time I shoot the enemy, it will create a random power up. It was some problems to pick it up when I stored the Game Object as a variable. I don't know why. But I tried one more time to use "Trigger Enter" on the power ups, and now it works. I don't know why it didn't work the first time. Maybe I did something wrong.

The object I have the action "Trigger Enter", needs to set to trigger and the object which enter the trigger, needs to have Rigid Body.
The problem is that, the object which enter the trigger, needs to move into the trigger. If it's not moving, the trigger doesn't work, if you know what I mean.
Check out our homepage. http://www.walsberg.no
Or my personal game blog for news about my games. http://retro-tetro.walsberg.no