Custom Events & SFX Manager (Bolt)

Поделиться
HTML-код
  • Опубликовано: 12 янв 2025

Комментарии • 27

  • @behnamrasooli8801
    @behnamrasooli8801 5 лет назад +13

    Something to note here is that you're indeed using an event-based communication, but you're sending a "Command", not an "Event". The difference is in the naming. This becomes extremely important when the project gets a bit bigger. The event sender shouldn't decide what should happen in response, and more importantly, shouldn't even care if anyone is interested. It's called fire-and-forget principle. Otherwise, it defeats the purpose of using an event-based communication. So in this example, we can name the event "PlayClickButtonWasClicked" and let other parts of the application decide what to do with it. The benefit is when we want to add a second event listener. Let's say we also want to shake the camera when this button is clicked. It doesn't quite sound right to say "shake the camera on PlayClick event". Because the event here is strongly suggesting to only play the click sound.

  • @justusforan
    @justusforan 3 года назад +1

    2 and a half years later this was the tip I needed, keep it up please!

  • @kevinmackey3166
    @kevinmackey3166 4 года назад +1

    To make things even simpler, you can add the audio clip for the Play Custom button as an object variable and set Arg. 0 of the Custom Event Trigger to that object variable. Then one Flow Macro can be used with any number of buttons, regardless of the audio clip associated with the individual buttons.

  • @Turkuaz-07
    @Turkuaz-07 3 года назад

    The best Bolt Tutorials. No Doubt. Thanks. Finally I understood how it works.

  • @bunnychan21
    @bunnychan21 4 года назад +2

    awesome, thanks for the tutorial!

  • @ItsXDaniC
    @ItsXDaniC 4 года назад +3

    Came from your other vid, great content, after the nightmare that coding was whem I tried it a while ago I tried Unreal and it's nodes, now I see these other nodes aren't as hard either, and after seeing how things are done with them I see myself going back to plain text at some point, but for now I'll stick with nodes.

  • @OfficialMageHD
    @OfficialMageHD 3 года назад

    I just spent all day working to redo my graphs to be smarter and less of a mess. Now I watch this video and now want to redo it again tomorrow. I'm excited. Your videos are really well done with a great pace and explanation.
    Also quick question if you happen to know the answer. Code Monkey has a video making a factory style automation game, I was wondering if you know of any similar videos but for Bolt? When I get around to trying to figure out that part of my game his video will work, but I have a much easier time wrapping my head around whats going on with visual scripting instead of coding.

    • @OneWheelStudio
      @OneWheelStudio  3 года назад

      I’m glad the videos are useful!
      I’m not aware of Bolt based videos making a factory style game. Sorry

  • @noobunity8436
    @noobunity8436 5 лет назад +3

    thank you so much for your share. hope you can share more if it needs money to listen to your course, I wish to buy. bolt is a good soft ,very good

    • @OneWheelStudio
      @OneWheelStudio  5 лет назад +1

      I'll be creating a lot more videos especially as Bolt 2 is released. My videos will stay free for the foreseeable future but you can always support my efforts on my Patreon page (patreon.onewheelstudio.com) :)

  • @pinatranaves
    @pinatranaves 3 года назад +1

    Great content, I'm using custom events a lot.
    I don't know if this is the right place for my question, but when I use:
    "on button input X" down -> trigger event X,
    and
    "on button input Y" down -> trigger event Y,
    if I press both buttons at the same time, the bolt will execute both events at the same time. Okay.
    But, I needed the bolt to execute one event at a time.
    I've tried using coldown between buttons, I've tried using branch conditions, nothing works when both buttons are pressed at the same time. Because there is no right order of being X after Y, it can be Y after X and so on.
    It seems more like an input system question.
    Which input will be executed first, or with priority, as both inputs are being pressed at the same time.
    I don't know if I was clear, but if you have something to comment on it, it would help me a lot, as I'm not finding this answer on the internet.

    • @OneWheelStudio
      @OneWheelStudio  3 года назад +1

      This is a tricky one. If I was doing this in C# I'd probably create a queue of events/delegates (actually the topic of an upcoming video) and add an entry when each button is pressed and then work my way through the queue. Something similar might be possible with Bolt, but I don't have much experience using Delegates with Bolt.
      If you just have the two inputs, X and Y, then you don't have to worry too much about the messiness. You could create a boolean (doingEvent) that is true when one event is occuring. The other event could wait until the boolean is false before starting. I haven't done this with Bolt, but seems like it should be doable.

    • @pinatranaves
      @pinatranaves 3 года назад +1

      @@OneWheelStudio I'll try something similar (although I've already tried an input coldown). If my only option is C#, I will probably cry! Thanks for the answer.

  • @anthonygirdler606
    @anthonygirdler606 3 года назад

    Is it possible to trigger a custom event using a c# script ?
    I'm asking because Codeless IAP seems to require a c# script with functions.
    I thought I could keep the script very simple and come straight back to visual scripting by triggering a custom event.

    • @OneWheelStudio
      @OneWheelStudio  3 года назад

      It should be. I’m never got to that point with Bolt but if you drop by the Bolt discord there should be folks that can point you in the right direction.

  • @uzivatelInternetu
    @uzivatelInternetu 4 года назад +3

    I just realised, that playback speed 0.75 is just right ;-)

  • @justinwhite2725
    @justinwhite2725 4 года назад +1

    It seems to me that requiring to know who the target is really defeats the purpose, and doesn’t match the description during the intro. You aren’t broadcasting the message for everyone who may be listening, you are targeting it from the get go.
    Edit: I think it’d be possible to create an event manager with bolt and have objects register themselves as listeners (similar to how c# does) in a similar manner to the way you registered gravity objects in your gravity video.
    Edit2: I figured it out. It’s a bit cryptic. The custom event input also has a gameobject reference. So you can put the gameobject there and when the event is called on that game object it’ll be triggered.
    All you need is an empty gameobject in an application variable to use as a ‘event manager’. It doesn’t actually need to do anything at all except exist. You then link it as the input and output everywhere you need it.

    • @OneWheelStudio
      @OneWheelStudio  4 года назад

      Events in Bolt 1 aren’t my favorite thing for these exact reasons. They really don’t work like C# events/delegates. In Bolt 2 they are much more like C# events. It’s one of the things I’m most excited about with Bolt 2.

    • @justinwhite2725
      @justinwhite2725 4 года назад

      @@OneWheelStudio I have events done through scriptable objects and I wanted to implement a system to allow those to trigger in bolt.
      I got it working. I have a game object that is in an application variable and I have a the bolt listeners register themselves on enable (and deregister on disable) and then I have a mono behavior listener (which is what I was using for the scriptable events already) send the event name and the attached argument to the manager and the manager uses the event name as a dictionary key to find all the game objects registered for that event and then sends that event to them as a bolt Custom Event with the argument.
      So now it's super easy to set up an event that works with my scriptavle object events - I just have to pass in the name of the event as an input (with no flow input) and it'll flow out like a custom event.
      Oh one other quirk - there's a bit of a race condition setting my event manager as a singleton before events are registered. So I set the 'on enable' for my listeners to be coroutines that check if that app variable is null. If null then wait 0.1 seconds and try again before sending the registry event.
      All of that is not ideal. Being able to tie into the C# event on the scriptable object directly or even handle unity events with arguments would have been much more straight forward.

    • @Woffenhorst
      @Woffenhorst 4 года назад

      @@justinwhite2725 Couldn't you use a global Event manager object to solve the coupling issue? Have the trigger fire the event from an event manager, and have all listeners listen to the event manager object?

    • @justinwhite2725
      @justinwhite2725 4 года назад

      @@Woffenhorst and how would they listen to the event manager in bolt? The only way to do that is with code, as far as I can tell.
      Except as I described in Edit 1 - use a list the way he did for the gravity tutorial.

    • @Woffenhorst
      @Woffenhorst 4 года назад

      @@justinwhite2725 As the Custom event entry point has a gameobject input I was thinking of having the event manager as a scene variable, so each object needing to use the event can reference it, the button triggers the event from the eventmanager, and the audiomanager listens to the eventmanager. The only reference needed is the eventmanager, the triggering object doesn't need to know about the existence of the audiomanager, or anything else listening to the event.

  • @MikeCore
    @MikeCore 5 лет назад +1

    wish you taught at my school XD

  • @Foqerman
    @Foqerman 4 года назад +1

    Please don't use global events/broadcasts, it is not performative and error prone.
    Always opt to use object-to-object communication whenever possible