Recursive Delegate Calls

 This week I worked on a number of different systems, but on problem stands out among the rest. I decided to use the OnClicked event of a button for one of our widgets. Upon initial use, I misunderstood how to use the event call and placed too many throughout the script. The result of using the OnClicked event for the same thing in two different scripts was the program would be thrown into a recursive loop and eventually crash. 

To solve the problem I first debugged as normal. Then after staying up way to late, I turned to the rubber ducky method and spoke to a fellow software engineer about the issue. While explaining the issue, it was found that the OnClicked event automatically broadcasts to all of the other OnClicked events throughout the script. After removing the excess events the script ran as intended. An added benefit is the script was a lot less crammed. 


Author: Zachary Giffin

Posted: 10/13/2023

Comments

Popular posts from this blog

Resolving the Flying AI Bug: Boundary Fix in Level One Environment

Paying attention to Details

Revamping the player's attacks