0
Answered

Passing Events/Recieving Events

Steve 2 years ago • updated by NeedsLoomis 2 years ago 4

Hello,

I'm having a difficult time figuring out how to pass and receive events between game objects, or on collision. But, just starting the State Machine and just On Enter State works just fine. I'd just like to understand custom events. Love the icon, btw of the wizards hat. :) 

What am I doing wrong?



Bolt Version:
Unity Version:
.NET Version:

Just passing the State Unit works fine, though. Cube does turn to red on collision. 

Answered

I'm guessing you're getting a conversion error?

The only little problem here is that a Material isn't a component, so when you're passing the first argument of the event as a game object, Bolt can't find the material automatically on that game object. (Edit: That's because there could be, in some cases, many materials on one game object).

You should add a Renderer: Get Material unit between Arg. 0 of the custom event listener and the first value port of Set Color. This returns the first (default) material on the attached renderer.

Cool, I'll give that a shot! Thanks.

Is this on a state or in a transition?  Try using the Custom in a transition which leads to a state where the color is changed on enter.