-
Book Overview & Buying
-
Table Of Contents
Unreal Engine 5 Game Development with C++ Scripting
By :
You probably felt a little uncomfortable with the redundant code blocks we wrote in the previous chapters; for example, the PlayerAvatar and Enemy classes have some identical attribute variables and functions. Can we instead combine them and maintain only one copy of code for those replicated variables and functions? Yes, and this will require us to refactor the code.
Code refactoring helps improve the internal structure of code so that it becomes more readable, maintainable, and efficient. The process includes algorithm optimization, duplicate removal, and code simplification.
For the Pangaea project, we identified two refactoring tasks:
PlayerAvatar and Enemy classesLet’s start with the first task.
Open and compare the PlayerAvatarAnimInstance.h, PlayerAvatarAnimInstance.cpp, EnemyAnimInstance...