class communication

Debuggers are extremely useful
Start from the top by setting a breakpoint in the “place” you expect your interaction logic to start, so probably AEBG_CharacterControllerBase::Interaction(). Check the values of surrounding variables (for example, are the pointers the code is about to use invalid?). If yes, you’ve possibly found a clue to the issue. If not, keep stepping into functions (for example, Interaction() calls Interact_Implementation(), just step into it and keep checking variables) until you find something strange. Report back to us if you find anything unclear.

Don’t guess, write code with intent
Both debugging (from your side) and trying to understand the code (from our side) is made harder if the code contains unused or misleading logic. A few examples:

  • Curly brackets are extremely important when executing logic, while whitespaces (at least in C++) aren’t. However, whitespaces (spaces, newlines, tabs) can significantly improve or degrade our understanding of how code is executed so take care to indent your code properly (there are also IDE settings to help you with those). If we take your snippet in ::InteractionTrace:


    A short glance at this image might mislead us to believe the two “more indented” if blocks are on the same indentation “level”, when actually they aren’t! The first one “contains” the second one, and the third one is “after” the first one (simplified terminology), so the first and the third one should be equally indented.

  • Try to keep your local variable definitions (i.e. the first mention of the variable’s name) close to its first use location (while accounting for variables used in multiple blocks, which sometimes forces you to define variables sooner). This both lets you understand the execution flow of your code better (because you can more easily read it top to bottom without backtracking) and lets you easily eliminate unnecessary /unused logic. While I don’t see any unused logic on the first glance, there are multiple variables defined before the first scope they’re needed in, decreasing readability.

  • Regarding intent, don’t do things just because “you think you need to”. For example, unless I’m missing something, this snippet:


    Calls IEBG_InteractionInterface::Interact_Implementation(), which (by the naming) seems to be an interface function. Seeing as you haven’t provided a snippet of that function, I’m assuming it has no implementation and is in fact empty (as interface functions usually are). Why is this here?

Help us help you
Figuring out what’s not working from partial snippets is kinda difficult, if you haven’t found the answer following the above tips, could you please:

  • clarify whether the current implementation crashes or just doesn’t work
    • if it crashes, please provide a callstack (a screenshot of the stack during the crash will do)
  • add the missing snippets (for example, the Begin/EndFocus implementation logic)