Performance Cost to Passing Delegates with Slate

I’ve been working with Slate to set up a menu framework for my game. The two ways I’ve found to handle showing/hiding the widgets at the proper time is to either use a state machine to control my menu states or to pass delegates around to a few key slate widgets to allow for changing states. I don’t yet fully understand how Slate works on the backend so I’m curious to see if someone knows whether or not passing delegates through a Slate Argument has a negative performance cost?

You haven’t really given enough info to know what exactly the delegates are doing. If you mean binding to a widget visibility delegate for example, then yeah, this is a performance hit if you do it with a bunch of widgets. The Slate data bindings are polled, so it will generally invoke the delegate every tick to get the latest value. That’s a lot of wasted function calls if the state only changes once in a while.

So, if you have a lot of widgets but they only show/hide every so often, you’d get better performance by not using delegates and just updating the visibility directly on state changes.