Implementing UI Delegates
Author Patrick Kelly
Date 10/21/2022
The problem encountered when programming a user interface is having the displayed values change when they are modified. The problem I ran into was having the user interface update the player currency when its modified without having to re-write or place additional code within other systems to command the user interface element to update.
The solution to this problem was using dynamic multicast delegates. By using these delegates, any system watching the player currency can update when another programmer uses the provided functions to modify the currency. This eliminates the need to check if the currency has been modified every tick as the delegate will broadcast to any elements or blueprints listening to the delegate. On one element, using tick to update a value on the user interface would not have any performance impact, but a game with hunreads of values updating could cause a noticeable impact. Delegates remove the need to constantly watch the value for a change and only runs when the value changes.
Comments
Post a Comment