Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics


Visual Scripting + Automation for Unity · By Evasion Games

Using Send Command

A topic by westray created Oct 02, 2019 Views: 285 Replies: 6
Viewing posts 1 to 5

How do I use the Send Command action to trigger an event on another gameobject?

Developer (1 edit)

First part, create the Command:

  1. Create a GameObject, rename it as "Target".
  2. Add the GameFlow component.
  3. Add an On Demand program.
  4. Add a Hello World action to the program.
  5. Add a Command block below the On Demand program.
  6. Drag the On Demand into the Program field of the Command.
  7. Rename the Command as "Say Hello".

Second part, using the Command:

  1. Create another GameObject.
  2. Add the GameFlow component.
  3. Add an On Start program.
  4. Add a Send Command action.
  5. Drag the GameObject named Target into the Target field of the Send Command action.
  6. Set "Say Hello" as Command Id.

This is a simple example just to clarify the usage, but Commands are normally used in situations where you need to execute a Program and you can't have the reference to that Program in anticipation like sending a "Die" Command to any GameObject that collides with a trigger. In those cases you would use Send Command with the <Other> parameter as Target, like this:

Hi ,thanks for your reply but it doesn't show how to use the Send Message action.

Developer (1 edit)

Oh, I see... my mistake. I was referring to the Send Command action in the last paragraph. Editing now.

Still can't get this to work,

This is what I have on my Ball object.                                                             t

      This is what I have on my Prefab Trigger object


am I doing something silly that this isn't working?

Developer (2 edits)

Isn't the On Demand program executing when the Command is sent to the instance of Trigger stored in <other> at runtime? I'd suggest you adding some Log Message actions or adding some breakpoints (click on the outer left side of any action) to debug the problem.

I got it working by putting the trigger on the platforms and when the ball leaves that trigger the platform falls ,waits for 5 seconds then destroys its  parent. I think using the ball as the trigger was the wrong way.The platforms are right next to each other and the ball was triggering the next one and so on.