Announcement

Collapse
No announcement yet.

Event or Function? Discuss.

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Event or Function? Discuss.

    I'm finding that for most of my functionality that I add to classes, I'm doing custom events. For example, I'm just getting started on a new class of enemy for my game called a "Crusher" and (just as in most of my other BPs) I'm making most all of the behavior as custom events as opposed to the more traditional "function". I was just adding a custom event called "Pick Target Tile" that could just as easily be a function that returns a tile index, but I find it more convenient and easier to create this as an event that I can see along side all my other "events" for the enemy. I hadn't really thought about this until now, and just wanted to see what others are doing.

    I think it's probably a six/half-a-dozen sort of thing, and there is no right or wrong answer here.

    I guess, I'm really using them this way: If it's behavior oriented, then it's an event. If it solves a problem, then I'll make it a function.

    So: If I'm going to Pick a target tile and Move my pawn over to that tile, I'm using events. But if I need to take two tiles and find the distance between them, I'm using a function.

    #2
    But events == functions in unreal. Only difference is if they return some value or not.

    Do experiment create blueprint interface, create 2 functions in in one with return parameter one without.
    Then add that interface to some blueprint. And see where both functions landed.

    Comment


      #3
      [QUOTE=Nawrot;513629]But events == functions in unreal. Only difference is if they return some value or not.[QUOTE]

      Yeah, exactly. Which is why the programming could go either way. I realize this seems like a silly question, but just because I feel this way, it doesn't mean that others don't have a different way they like to do some things. It's really more of an open-ended question just to see how different people think.

      Comment


        #4
        For me it all depends if i must do it (when i need some value back it is function). For rest cases if its important enough to be in graph or can be hidden as function. But generally if i can i hide it all as functions.

        Comment


          #5
          I only use events when I need to take advantage of replication, or Macros (For whatever reason) cannot do what I am trying to accomplish. Functions can return values, as well as have local variables, events can be replicated.
          Marketplace Assets

          Advanced Mobile Input: Marketplace Page | Support Thread ――― Easy Input Remapping: Marketplace Page | Support Thread
          Multiplayer Blueprint Chat System: Marketplace Page | Support Thread ――― Closing Credits System: Marketplace Page | Support Thread
          Minesweeper Template: Marketplace Page | Support Thread ――― Maze Creator: Marketplace Page | Support Thread

          Comment


            #6
            And events can call functions as well.
            They broke the signatures so I removed mine thinking it'd be awhile. The signatures work again, but I haven't redone my signature yet.

            Comment

            Working...
            X