The check()
is completely optional. NewObject
will call CheckIsClassChildOf_Internal
which does the same check internally (depending on some defines). And it also makes sure the given class actually is the same as or a child of UCF_Skill_Base
in your case. I always tend to have checks for things that need to be configured in a certain way for the class to function as intended. There may be a better place to put the check in your code so you know as early as possible that you haven’t setup the SkillClassArray
correctly.
With a debugger attached any check that fails will cause the debugger to break within the check allowing you to inspect the state of the involved objects and variables. Depending on the code, execution may then resume as normal. In case of NewObject
though, StaticConstructObject_Internal
is called which directly accesses the class that it gets passed along. In case the class is invalid the game/editor crashes.